private void ExitBtn_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("런처를 종료하시겠습니까?", "호크아이 런처", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { //do no stuff } else { Taskbar.Show(); this.Close(); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { #if false if (MessageBox.Show("Close Application?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { //do no stuff } else { Taskbar.Show(); this.Close(); } #endif }
public MainWindow() { InitializeComponent(); KillAllProcess(); Maximize(); launcherSetup.ReadIni(); Taskbar.Hide(); Task.Run(() => { UdpClient client = new UdpClient(); client.ExclusiveAddressUse = false; IPEndPoint localEp = new IPEndPoint(IPAddress.Any, 2222); client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); client.ExclusiveAddressUse = false; client.Client.Bind(localEp); IPAddress multicastaddress = IPAddress.Parse("239.0.0.222"); client.JoinMulticastGroup(multicastaddress); Console.WriteLine("Listening this will quit"); while (true) { byte[] data = client.Receive(ref localEp); //string strData = Encoding.Unicode.GetString(data, 0, data.Length); string strData = Encoding.Unicode.GetString(data).TrimEnd('\0'); Console.WriteLine("received data : {0}", strData); string text = ""; text = strData; if (strData == "PTZClient_AuthorityServer Mainfunction is blocked") { //text = String.Format(strData+"({0})", ++Hawkeye_PTZClient_AuthorityServer_Message_Count); m_bHawkeye_PTZClient_AuthorityServer_Booting = true; continue; } if (strData == "RelayServer Mainfunction is blocked") { //text = String.Format(strData+"({0})", ++Hawkeye_PTZClient_AuthorityServer_Message_Count); m_bHawkeye_RelayServer_Booting = true; continue; } this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => { logTextBox.Text = text; })); if (strData == "quit") { break; } } Console.WriteLine("quit the program to ENTER"); Console.ReadLine(); }); }