本文整理汇总了C#中MainWindow.Activate方法的典型用法代码示例。如果您正苦于以下问题:C# MainWindow.Activate方法的具体用法?C# MainWindow.Activate怎么用?C# MainWindow.Activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWindow
的用法示例。
在下文中一共展示了MainWindow.Activate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
public void Show(MainWindow window)
{
if (window == null)
throw new ArgumentNullException(nameof(window));
_window = window;
_window.IsVisibleChanged += WindowOnIsVisibleChanged;
_trayIcon = new NotifyIcon { Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetEntryAssembly().ManifestModule.Name), Text = "Hydra" };
_trayMenu = (ContextMenu)Resources["TrayMenu"];
_trayIcon.Click += (s1, e1) =>
{
if (((MouseEventArgs)e1).Button == MouseButtons.Left)
{
ShowHideMainWindow(null, null);
}
else
{
_trayMenu.IsOpen = true;
_window.Activate();
}
};
_trayIcon.Visible = true;
}
示例2: btnLogin_Click
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
if (ubzm.validateUser(txtLoginId.Text, txtPassword.Text))
{
MainWindow mw = new MainWindow();
this.Close();
mw.Activate();
mw.Show();
}
else
MessageBox.Show("Invalid User");
}
示例3: MainWindow
public static void MainWindow()
{
if (!MainWindowFocus())
{
MainWindow main = new MainWindow();
Memory.MainWindow = main;
main.WindowStartupLocation = System.Windows.WindowStartupLocation.Manual;
main.Top = 0;
main.Left = SystemParameters.PrimaryScreenWidth - main.Width;
main.Height = SystemParameters.PrimaryScreenHeight;
main.Show();
main.Activate();
}
}
示例4: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose;
MainWindow mainWindow = new MainWindow();
MainWindow = mainWindow;
Task.Factory.StartNew(() =>
{
while (true)
{
_startClient.Reset();
Thread newWindowThread = new Thread(() =>
{
ConnectionWindow connectionWindow = new ConnectionWindow();
connectionWindow.Show();
System.Windows.Threading.Dispatcher.Run();
});
newWindowThread.SetApartmentState(ApartmentState.STA);
newWindowThread.IsBackground = true;
newWindowThread.Start();
try
{
_startClient.WaitOne();
AsynchronousClientSocket.StartClient();
//the function waites until a user inputs an ip address using the window created above
//if a connection fails, a new ip window pops up in a dffrent thread
}
catch (Exception _e)
{
MessageBox.Show(_e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
});
_connected.WaitOne();//the signal is received from AsynchronousClientSocket.StartClient() when it gets connected
mainWindow.Show();
mainWindow.Activate();
}
示例5: _progTimer_Tick1
private void _progTimer_Tick1(object sender, EventArgs e)
{
try {
counter--;
if (counter == 0) {
Properties.Settings.Default.firstStartCompleted = true;
Properties.Settings.Default.Save();
var main = new MainWindow();
main.Activate();
Close();
}
}
catch (Exception ex) {
MessageBox.Show(ex.Message, "_progTimer_Tick1");
}
}