public void OnAlert(DateTime time) { // Clone window action (F5) if (time == DateTime.MinValue) { ClientWindow Child = new ClientWindow(child: true); Child.Show(); } // Closing child else if (time == DateTime.MaxValue) { IsOriginalChild = false; this.Close(); } // Update date/time alert else { Dispatcher.Invoke(new Action(() => { // Draw clock image Bitmap Bitmap = DrawClockFace.DrawClockFace(time, (int)imgClock.Width, (int)imgClock.Height); ImageSource Image = loadBitmap(Bitmap); imgClock.Source = Image; // Display date/time string txtDateTime.Text = time.ToString(); })); } }
private void StartWindow(string userName, int left, int top) { ClientWindow w = new ClientWindow(); w.Left = left; w.Top = top; w.UserName = userName; w.Owner = this; w.Closed += (sender, e) => this.Activate(); w.Show(); }
/// <summary> /// Launching client window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void App_OnStartup(object sender, StartupEventArgs e) { var connectForm = new ConnectWindow(); if (connectForm.ShowDialog() != true) { return; } var chatClient = new ChatClient(connectForm.PortNumber, connectForm.IpAddress, connectForm.UserName); if (!chatClient.IsConnected) { Current.Shutdown(); return; } var clientForm = new ClientWindow(chatClient); clientForm.Show(); }