예제 #1
0
        public CIPCClient(TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client client)
        {
            this.tb.Text = client.name + "\n"
                + client.remoteIP + "\n"
                + client.remotePort + "\n"
                + client.FPS + "\n"
                + client.mode;

            this.Width = 150;
            this.Height = 100;
            this.client = client;

            this.rect.RadiusX = 5;
            this.rect.RadiusY = 5;
            this.rect.StrokeThickness = 5;
            this.rect.Stroke = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
            this.rect.Fill = new SolidColorBrush(Color.FromArgb(150, 100, 0, 0));

            this.List_Port.Add(new CIPCConnectionPort(this.client.remotePort));
            this.stackpanel1.Children.Add(this.List_Port[0]);
            this.ToolTip = client.name;
            this.ToolTip += "\n中ボタンをドラッグで\n移動します";
        }
예제 #2
0
 /// <summary>
 /// CIPCからデータを受信し、Canvasを更新します。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void Eventer_ReportInfo(object sender, TerminalConnectionSettings.ServerProtocols.ReportInfo e)
 {
     this.CIPCinfo = e;
     this.UpdateContents();
     this.UpdateCanvasServerContents();
 }
예제 #3
0
 void Eventer_TurnOnSyncConnect(object sender, TerminalConnectionSettings.TerminalProtocols.TurnOnSyncConnect e)
 {
     try
     {
         this.Dispatcher.BeginInvoke(new Action(() =>
         {
             this.CheckBox_IsSyncReceived.IsChecked = true;
         }));
     }
     catch (Exception ex)
     {
         this.debugwindow.DebugLog = "[" + this.ToString() + "]" + ex.Message;
     }
 }
예제 #4
0
 void Eventer_SaveConnectionFast(object sender, TerminalConnectionSettings.TerminalProtocols.SaveConnectionFast e)
 {
     this.Dispatcher.BeginInvoke(new Action(() =>
     {
         this.ConnectionSettingSaveFast();
     }));
 }
예제 #5
0
 void Eventer_Restart(object sender, TerminalConnectionSettings.TerminalProtocols.Restart e)
 {
     this.Dispatcher.BeginInvoke(new Action(() =>
     {
         this.Close();
         Thread.Sleep(300);
         System.Diagnostics.Process.Start(Application.ResourceAssembly.Location);
     }));
 }
예제 #6
0
 void Eventer_DisConnect(object sender, TerminalConnectionSettings.TerminalProtocols.DisConnect e)
 {
     try
     {
         this.Dispatcher.BeginInvoke(new Action(() =>
         {
             this.checkid_sender = e.SenderPort;
             this.checkid_receiver = e.ReceiverPort;
             this.DCS.delete_connection(this.rhServer.List_RemoteHost.Find(HostFindFromNetwork_sender), this.rhServer.List_RemoteHost.Find(HostFindFromNetwork_receiver));
             this.DCS.ListBox_update(this.LISTBOX_DATA_CONNECTION);
             this.ConnectionChangeNoticetoTerminal();
         }));
     }
     catch (Exception ex)
     {
         this.debugwindow.DebugLog = "[" + this.ToString() + "]" + ex.Message;
     }
 }
예제 #7
0
 void Eventer_DemmandInfo(object sender, TerminalConnectionSettings.TerminalProtocols.DemmandInfo e)
 {
     try
     {
         this.rhServer.remoteOperator.sendStatesToAllEP();
     }
     catch (Exception ex)
     {
         this.debugwindow.DebugLog = "[" + this.ToString() + "]" + ex.Message;
     }
 }
예제 #8
0
 void Eventer_Close(object sender, TerminalConnectionSettings.TerminalProtocols.Close e)
 {
     this.Dispatcher.BeginInvoke(new Action(() =>
     {
         this.Close();
     }));
 }
예제 #9
0
 public void Udp_Send(TerminalConnectionSettings.TerminalProtocols.CIPCTerminalCommand terminalcommand)
 {
     try
     {
         if (this.IsConnectionSetupped)
         {
             UDP_PACKETS_CODER.UDP_PACKETS_ENCODER enc = new UDP_PACKETS_CODER.UDP_PACKETS_ENCODER();
             enc += (int)20;
             enc += (string)terminalcommand.Data;
             this.client.Send(enc.data);
         }
         else
         {
             throw new Exception("接続設定をしてください");
         }
     }
     catch (Exception ex)
     {
         this.debuglog.DebugLogPrint = this.debuglog.DebugLogPrint = "[" + this.ToString() + "]" + ex.Message;
     }
 }
예제 #10
0
 //private void Init_Task()
 //{
 //    try
 //    {
 //        if (this.CTS != null)
 //        {
 //            this.CTS.Cancel();
 //            Thread.Sleep(100);
 //            this.CTS = null;
 //            this.mytask = null;
 //            Thread.Sleep(100);
 //        }
 //        this.CTS = new CancellationTokenSource();
 //        this.mytask = new Task(maintask, this.CTS);
 //        this.mytask.Start();
 //    }
 //    catch (Exception ex)
 //    {
 //        this.debuglog.DebugLogPrint = "[" + this.ToString() +"]" + ex.Message;
 //    }
 //}
 //private void maintask(object obj)
 //{
 //    while (!this.CTS.IsCancellationRequested)
 //    {
 //        try
 //        {
 //            this.Setup_in_Task();
 //            while (!this.CTS.IsCancellationRequested)
 //            {
 //                this.Update_in_Task();
 //            }
 //        }
 //        catch (Exception ex)
 //        {
 //            this.debuglog.DebugLogPrint = "[" + this.ToString() +"]" + ex.Message;
 //            this.mainwindow.DeleteContents();
 //        }
 //    }
 //}
 //private void Update_in_Task()
 //{
 //    if (this.tcpclient != null && this.ns != null)
 //    {
 //        this.Tcp_Receive();
 //        this.Eventer.Handle(receive.stringData);
 //    }
 //}
 public void Tcp_Send(TerminalConnectionSettings.TerminalProtocols.CIPCTerminalCommand terminalcommand)
 {
     try
     {
         //this.send.stringData = terminalcommand.Data;
         //this.ns.Write(this.send.encodedbytes, 0, this.send.encodedbytes.Length);
         //this.debuglog.DebugLogPrint = "[" + this.ToString() + "]送信:" + this.send.stringData;
     }
     catch (Exception ex)
     {
         this.debuglog.DebugLogPrint = this.debuglog.DebugLogPrint = "[" + this.ToString() + "]" + ex.Message;
     }
 }
예제 #11
0
        public static void Udp_Send(UDP_PACKETS_CLIANT.UDP_PACKETS_CLIANT client, TerminalConnectionSettings.TerminalProtocols.CIPCTerminalCommand terminalcommand)
        {
            try
            {
                UDP_PACKETS_CODER.UDP_PACKETS_ENCODER enc = new UDP_PACKETS_CODER.UDP_PACKETS_ENCODER();
                enc += (int)20;
                enc += (string)terminalcommand.Data;
                client.Send(enc.data);

            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #12
0
        public CIPCServerClientHost(TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client client)
        {
            this.tb.Text = client.MyPort.ToString()+" "+ client.mode.ToString()+"\n"
                + client.name+"\n"
                + client.remotePort.ToString();

            this.Width = 180;
            this.Height = 80;
            this.client = client;

            this.rect.RadiusX = 5;
            this.rect.RadiusY = 5;
            this.rect.StrokeThickness = 5;
            this.rect.Stroke = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
            if (this.client.mode == TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode.Sender)
            {
                this.rect.Fill = new SolidColorBrush(Color.FromArgb(150, 0, 0, 100));
            }
            else if (this.client.mode == TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode.Receiver)
            {
                this.rect.Fill = new SolidColorBrush(Color.FromArgb(150, 100, 0, 0));
            }

            this.List_Port.Add(new CIPCConnectionPort(this.client.remotePort));
            this.stackpanel1.Children.Add(this.List_Port[0]);
            this.ToolTip = client.name;
            this.ToolTip += "\n中ボタンをドラッグで移動\n右ボタンをドラッグで新しい接続を開始";
            this.MouseDown += CIPCServerClientHost_MouseRightButtonDown;
            this.MouseRightButtonUp += CIPCServerClientHost_MouseUp;
            this.MouseMove -= this.CIPCContent_MouseMove;
            this.MouseMove += this.CIPCServerClientHost_MouseMove;
        }
예제 #13
0
        public CIPCServer(TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo cipcinfo)
        {
            this.tb.Text = "CIPCServer" + "\n"
                + cipcinfo.ClientList.Count;

            this.Width = 200;
            this.Height = 150;
            this.cipcinfo = cipcinfo;

            this.rect.RadiusX = 5;
            this.rect.RadiusY = 5;
            this.rect.StrokeThickness = 5;
            this.rect.Stroke = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
            this.rect.Fill = new SolidColorBrush(Color.FromArgb(150,0,100,0));

            for (int i = 0; i < cipcinfo.ClientList.Count; i++)
            {
                this.List_Port.Add(new CIPCConnectionPort(this.cipcinfo.ClientList[i].remotePort));
            }

            for (int i = 0; i < cipcinfo.ClientList.Count; i++)
            {
                this.stackpanel1.Children.Add(this.List_Port[i]);
            }

            Button button = new Button();
            button.Content = " 詳細 ";
            button.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            button.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            button.Margin = new Thickness(10);
            button.Click += button_Click;
            this.Children.Add(button);

            this.ToolTip = "CIPCServer";
            this.ToolTip += "\n中ボタンをドラッグで\n移動します";
        }
예제 #14
0
 void Eventer_DemmandInfo(object sender, TerminalConnectionSettings.TerminalProtocols.DemmandInfo e)
 {
     try
     {
         this.TC.Tcp_Send();
     }
     catch (Exception ex)
     {
         this.debugwindow.DebugLog = "[" + this.ToString() + "]" + ex.Message;
     }
 }
예제 #15
0
 private void Eventer_DisConnectByName(object sender, TerminalConnectionSettings.TerminalProtocols.DisConnectByName e)
 {
     this.Dispatcher.BeginInvoke(new Action(() =>
     {
         this.DCS.delete_connection(this.rhServer.List_RemoteHost.Find(p => p.Name == e.SenderName), this.rhServer.List_RemoteHost.Find(p => p.Name == e.ReceiverName));
         this.DCS.ListBox_update(this.LISTBOX_DATA_CONNECTION);
         this.ConnectionChangeNoticetoTerminal();
     }));
 }