- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
情况是这样的。我目前正在开发 C# WPF 桌面应用程序,我想在启动该程序时添加启动画面。
但我没有使用 SplashScreen 类。我在同名应用程序之上使用了一个额外的 WPF 窗口类,我称该类为 Splashy。
我的初始屏幕有一个动画 GIF 图像,当在下面的 Splashy 类的 WebBrowser 控件上动画时效果很好...
<Image gif:ImageBehavior.AnimatedSource="Images/FSIntro.gif" Margin="10,1,0,10">
<Image.OpacityMask>
<ImageBrush ImageSource="Images/FSIntro.gif"/>
</Image.OpacityMask>
</Image>
...并且 Splashy 类本身在 App.XAML 中初始化为 StartupUri。
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
... ...
... (some text) ...
... ...
StartupUri="Splashy.xaml">
<Application.Resources>
但该场景的问题是启动画面只是挂起,并没有进入主程序本身。
所以我尝试了一种不同的方法。一个使用代码。
当我将以下代码实现到启动画面,然后将其实现到我的程序以运行启动画面,然后显示主屏幕时,启动画面执行我想执行的操作但它没有动画如我所愿。
下面是Splashy类的代码
public partial class Splashy : Window
{
public Intro()
{
InitializeComponent();
}
public void Outro()
{
this.Close();
}
}
下面是实现启动画面的程序方法。
public partial class LoginScreen : Window
{
Splashy splash = new Splashy();
public LoginScreen()
{
splash.Show();
Thread.Sleep(5000);
splash.Outro();
// home screen
}
}
如有任何指点和帮助,我们将不胜感激。
最佳答案
我会尝试这样的事情。创建一个处理所有这些逻辑的 Bootstrapper
类。
public class BootStrapper
{
SplashScreen Splash = new SplashScreen();
MainWindow MainWindow = new MainWindow();
public void Start()
{
var timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(2);
timer.Tick += (s, e) =>
{
Splash.Close();
MainWindow.Show();
timer.Stop();
};
timer.Start();
Splash.Show();
}
}
从 App.xaml
中删除 StartupUri
,这样就不会首先创建您的 MainWindow
。
<Application x:Class="StackOverflow.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:StackOverflow"
StartupUri="MainWindow.xaml">
变成...
<Application x:Class="StackOverflow.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:StackOverflow">
然后,在 App.xaml.cs
中,覆盖启动,以便它创建您的 Bootstrapper
类的新实例。
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
var bootStrapper = new BootStrapper();
bootStrapper.Start();
base.OnStartup(e);
}
}
关于c# - 带有动画 GIF 的启动画面在 WPF C# 中没有动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50664221/
我有一个表,用于测量数据集中两个不同值的分布百分比(我有一个计数,替换为 Percentage )。我只想在仪表板中发布 85% 的值。这样做的步骤是什么? .现在,如果我过滤掉 NO 值, YES
我想平均N通过Type对于 Inst 的值 我的数据设置为: Type, Inst, N A, A1, 4 A, A1, 13 A, A1, 13 A, A2, 4 A, A3, 5 B, B1, 4
当我使用 Node 的 http2 库(仅支持 HTTPS,不支持 HTTP)进行开发时,当我在 Chrome 中打开 localhost 时,我会看到一个警告屏幕: Your connection
我想创建一个具有响应式布局的导航栏菜单。当网站显示在显示器上时,我想播放导航栏。当网站在手机上显示时,我会显示最终显示导航栏的菜单图标。 我该怎么做? 最佳答案 试试这个,在移动设备上,导航栏不仅会显
我聘请了一名程序员为我创建一个 iPhone 应用程序。该应用程序的目的是拍照并将其上传到服务器。我们想制作一个特殊用途的屏幕,以便在上传照片之前查看照片。这个专门开发的屏幕将具有至关重要的缩放功能。
我在 Tableau 上有一个我无法解决的简单问题。 我想显示一个图表,显示随时间变化的度量。我想将用户通过参数选择的一个客户端与未选择的所有其他客户端进行比较。该图将显示具有 2 种不同颜色的两条线
我使用 Python 脚本从 3 个不同的 RDS 执行一系列复杂查询,然后将数据导出到一个 CSV 文件中。我现在正在尝试找到一种方法,每周将使用这些数据的仪表板自动发布到 Tableau 服务器中
我在工作中使用 tableau 来处理各种数据类型,包括敏感的个人数据,这些数据只能以聚合格式共享。我试图找到一种方法来保护私有(private)信息,方法是在单元格值小于 5 时隐藏它。这样,当用户
我最近开始在网站上嵌入 Tableau 可视化效果,并遇到了在浏览器中直接使用 Control + P 打印它们的问题。大多数完全扭曲,如果有的话。我做了一些挖掘,发现这是一个已知问题: http:/
例如,此 URL 包含十几个项目:https://tableautest.domain.uk/t/CustomerSharing/view/projects 在每个项目中都有几个工作簿。每个工作簿中都
我正在研究如何使用 Tableau 连接到 Cloudera Hadoop。我提供服务器和端口详细信息并使用“Impala”进行连接。我能够成功连接,选择默认模式并选择所需的表。 在此之后,当我将维度
我正在尝试将 Tableau 工作表嵌入到我的 ReactJS 应用程序中。我有一个包含报告名称列表的菜单(在 react 中),当单击菜单项时,它会更新包含报告名称的状态。我决定使用 tableau
我有以下问题!我有一个这样的表: Data Source 我想创建一个可以获取 apl_id 的字段(我想这是一个字段),有一些我想要的 service_offered。 上表中的示例。如果我想要只有
我有一个航类延误数据电子表格,我正在处理一个显示每个机场总延误时间的工作表。我想过滤维度“机场”,即根据每个机场的起飞次数创建机场类别,“小型”、“中型”和“大型”,这是通过计算维度“航类号”计算得出
我想创建一个带有过滤器的表格,用于选择和比较事物: 假设我有一个变量 Var,包含值 A、B、C、D、E。我想要一个过滤器,以便用户可以选择 A B C D 之一,同时 E 始终被选中。这样选中的E和
我是一名优秀的程序员,十分优秀!