/// <summary> /// メインウィンドウ終了イベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { myparts.myDialog dialog = new myparts.myDialog("全プロセスを終了します."); if (dialog.ShowDialog() == false) { e.Cancel = true; } if (e.Cancel == false) { this.serialport.Close(); } } catch (Exception ex) { while (true) { myparts.myDialog dialog = new myparts.myDialog(ex.Message); if (dialog.ShowDialog() == true) { break; } } } }
private void Button_PPMS_Serial_Connect_Click(object sender, RoutedEventArgs e) { try { myparts.myDialog dlg = new myparts.myDialog("シリアルポートに接続します"); if (dlg.ShowDialog() != true) { return; } this.serialport = new System.IO.Ports.SerialPort("COM" + this.TextBox_PPMS_COMPORT.Text, int.Parse(this.TextBox_PPMS_BaudRate.Text), System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One); this.serialport.Encoding = Encoding.ASCII; byte[] endsign = { 170, 255 }; this.serialport.NewLine = Encoding.ASCII.GetString(endsign, 0, 1); this.serialport.Open(); this.fps = new FPSAdjuster.FPSAdjuster(); fps.Fps = int.Parse(this.TextBox_PPMS_FPS.Text); fps.Start(); this.CTS = new CancellationTokenSource(); this.maintask = new Task(new Action(this.MainTask_PPMS), this.CTS.Token); this.maintask.Start(); } catch (Exception ex) { myparts.myDialog dlg = new myparts.myDialog(ex.Message); dlg.ShowDialog(); } }
private void Button_Connect_Click(object sender, RoutedEventArgs e) { myparts.myDialog mydialog = new myparts.myDialog("接続を開始します"); if (mydialog.ShowDialog() != true) { return; } this.StackPanel_ConnectSetting.IsEnabled = false; this.IsConnectSetuped = true; this.pushedtime = System.DateTime.Now.ToString(); this.TabControl_CIPCConnection.SelectedIndex = 1; this.mainwindow.serverconnection.SetupUDP(); }
private void Button_MKCL_Serial_Close_Click(object sender, RoutedEventArgs e) { try { myparts.myDialog dlg = new myparts.myDialog("シリアルポートを切断します"); if (dlg.ShowDialog() != true) { return; } this.CloseComport(); } catch (Exception ex) { myparts.myDialog dlg = new myparts.myDialog(ex.Message); dlg.ShowDialog(); } }
/// <summary> /// 終了ボタンのクリックイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Close_Click(object sender, RoutedEventArgs e) { try { this.Close(); } catch (Exception ex) { while (true) { myparts.myDialog dialog = new myparts.myDialog(ex.Message); if (dialog.ShowDialog() == true) { break; } } } }
private void Change_StatusBar_TextBlock(string text) { try { this.TextBlock_StatusCaption.Text = text; } catch (Exception ex) { while (true) { myparts.myDialog dialog = new myparts.myDialog(ex.Message); if (dialog.ShowDialog() == true) { break; } } } }
private void Button_MKCL_Serial_Connect_Click(object sender, RoutedEventArgs e) { try { myparts.myDialog dlg = new myparts.myDialog("シリアルポートに接続します"); if (dlg.ShowDialog() != true) { return; } this.serialport = new System.IO.Ports.SerialPort("COM" + this.TextBox_MKCL_COMPORT.Text, int.Parse(this.TextBox_MKCL_BaudRate.Text), System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One); this.serialport.Encoding = Encoding.ASCII; this.serialport.Open(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void start() { try { System.Diagnostics.Process[] CIPC = System.Diagnostics.Process.GetProcessesByName("CentralInterProcessCommunicationServer"); if (CIPC.Length == 0) { System.Diagnostics.Process.Start(this.window.TextBox_Local_CIPCServerPath.Text); } } catch (Exception ex) { while (true) { myparts.myDialog mydialog = new myparts.myDialog(ex.Message); if (mydialog.ShowDialog() == true) { break; } } } }
private void Button_Network_AddFolder_Click(object sender, RoutedEventArgs e) { try { string FolderName; System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); folderBrowserDialog1.Description = "公開するフォルダを選択してください.(注意:他人に公開されます.公序良俗に反するものや,個人情報の含まれるものは指定しないようにお気を付けください.)"; if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { FolderName = folderBrowserDialog1.SelectedPath; this.AddFolderByPath(FolderName); } } catch (Exception ex) { myparts.myDialog dlg = new myparts.myDialog(ex.Message); dlg.ShowDialog(); } }
/// <summary> /// statusbarの状態を変更する /// </summary> /// <param name="text"></param> public void Change_StatusBar_TextBlock(string text) { try { this.Dispatcher.BeginInvoke(new Action(() => { this.TextBlock_StatusCaption.Text = text; })); } catch (Exception ex) { while (true) { myparts.myDialog dialog = new myparts.myDialog(ex.Message); if (dialog.ShowDialog() == true) { break; } } } }
private void Button_PPMS_Serial_Connect_Click(object sender, RoutedEventArgs e) { try { myparts.myDialog dlg = new myparts.myDialog("シリアルポートに接続します"); if (dlg.ShowDialog() != true) { return; } this.serialport = new System.IO.Ports.SerialPort("COM" + this.TextBox_PPMS_COMPORT.Text, int.Parse(this.TextBox_PPMS_BaudRate.Text), System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One); this.serialport.Encoding = Encoding.ASCII; this.serialport.Open(); this.fps = new FPSAdjuster.FPSAdjuster(); fps.Fps = int.Parse( this.TextBox_PPMS_FPS.Text); fps.Start(); this.CTS = new CancellationTokenSource(); this.maintask = new Task(new Action(this.MainTask_PPMS), this.CTS.Token); this.maintask.Start(); } catch (Exception ex) { myparts.myDialog dlg = new myparts.myDialog(ex.Message); dlg.ShowDialog(); } }
private void Button_Test_Click(object sender, RoutedEventArgs e) { CIPCNetwork.Protocols.Message msg = new CIPCNetwork.Protocols.Message(); msg.Header = CIPCNetwork.Protocols.Message.HeaderType.GetFileList; msg.Data = "asdasdasdasd"; CIPCNetwork.Protocols.Message msg2 = CIPCNetwork.Protocols.Message.SetFromString(msg.ToString()); myparts.myDialog mydialog = new myparts.myDialog(msg2.ToString()); mydialog.ShowDialog(); }
/// <summary> /// メインウィンドウ終了イベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { myparts.myDialog dialog = new myparts.myDialog("全プロセスを終了します."); if (dialog.ShowDialog() == false) { e.Cancel = true; } if (e.Cancel == false) { this.dispatchertimer.Stop(); this.Close_ChildWindows(); this.Dispose_Classes(); } } catch (Exception ex) { while (true) { myparts.myDialog dialog = new myparts.myDialog(ex.Message); if (dialog.ShowDialog() == true) { break; } } } }
private void Button_StopConnect_Click(object sender, RoutedEventArgs e) { myparts.myDialog mydialog = new myparts.myDialog("接続を停止します"); if (mydialog.ShowDialog() != true) { return; } this.StackPanel_ConnectSetting.IsEnabled = true; this.IsConnectSetuped = false; this.TabControl_CIPCConnection.SelectedIndex = 0; this.mainwindow.serverconnection.closeUDP(); }