Example #1
0
        /// <summary>
        /// CIPCの状態を送信する
        /// </summary>
        public void Tcp_Send()
        {
            try
            {
                List <TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client>     clientlist     = new List <TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client>();
                List <TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Connection> connectionlist = new List <TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Connection>();
                if (this.RHS.List_RemoteHost.Count > 0)
                {
                    foreach (var count in this.RHS.List_RemoteHost)
                    {
                        TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode mode;
                        if (count.Connection_Mode == ConnectionState.Sender)
                        {
                            mode = TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode.Sender;
                        }
                        else if (count.Connection_Mode == ConnectionState.Receiver)
                        {
                            mode = TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode.Receiver;
                        }
                        else
                        {
                            mode = TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode.Default;
                        }

                        clientlist.Add(new TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client(count.ID, count.Name, int.Parse(count.remotePort), count.remoteIP, count.Fps, mode));
                    }
                }
                if (this.DCS.List_dataconnection.Count > 0)
                {
                    foreach (var count in this.DCS.List_dataconnection)
                    {
                        connectionlist.Add(new TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Connection(count.SENDER.ID, count.RECEIVER.ID));
                    }
                }


                bool IsSyncConnect = false;
                System.Windows.Threading.DispatcherOperation DO = this.mainwindow.Dispatcher.BeginInvoke(new Action(() =>
                {
                    IsSyncConnect = this.mainwindow.CheckBox_IsSyncReceived.IsChecked == true ? true : false;
                }));
                DO.Wait();

                TerminalConnectionSettings.ServerProtocols.ReportInfo reportinfo = new TerminalConnectionSettings.ServerProtocols.ReportInfo(new TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo(clientlist, connectionlist, IsSyncConnect));

                this.send.stringData = reportinfo.Data;
                this.networkstream.Write(this.send.encodedbytes, 0, this.send.encodedbytes.Length);
                this.debugwindow.DebugLog = "[TerminalConnection]送信:" + this.send.stringData;
            }
            catch (Exception ex)
            {
                this.debugwindow.DebugLog = "[" + this + "]" + ex.Message;
            }
        }
Example #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();
 }
        /// <summary>
        /// CIPCの状態を送信する
        /// </summary>
        public void Tcp_Send()
        {
            try
            {
                List<TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client> clientlist = new List<TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client>();
                List<TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Connection> connectionlist = new List<TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Connection>();
                if (this.RHS.List_RemoteHost.Count > 0)
                {
                    foreach (var count in this.RHS.List_RemoteHost)
                    {
                        TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode mode;
                        if (count.Connection_Mode == ConnectionState.Sender)
                        {
                            mode = TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode.Sender;
                        }
                        else if (count.Connection_Mode == ConnectionState.Receiver)
                        {
                            mode = TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode.Receiver;
                        }
                        else
                        {
                            mode = TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client.Mode.Default;
                        }

                        clientlist.Add(new TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Client(count.ID, count.Name, int.Parse(count.remotePort), count.remoteIP, count.Fps, mode));
                    }
                }
                if (this.DCS.List_dataconnection.Count > 0)
                {
                    foreach (var count in this.DCS.List_dataconnection)
                    {
                        connectionlist.Add(new TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo.Connection(count.SENDER.ID, count.RECEIVER.ID));
                    }
                }

                bool IsSyncConnect=false;
                System.Windows.Threading.DispatcherOperation DO = this.mainwindow.Dispatcher.BeginInvoke(new Action(() =>
                {
                    IsSyncConnect = this.mainwindow.CheckBox_IsSyncReceived.IsChecked == true ? true : false;
                }));
                DO.Wait();

                TerminalConnectionSettings.ServerProtocols.ReportInfo reportinfo = new TerminalConnectionSettings.ServerProtocols.ReportInfo(new TerminalConnectionSettings.ServerProtocols.ReportInfo.CIPCInfo(clientlist, connectionlist,IsSyncConnect));

                this.send.stringData = reportinfo.Data;
                this.networkstream.Write(this.send.encodedbytes, 0, this.send.encodedbytes.Length);
                this.debugwindow.DebugLog = "[TerminalConnection]送信:" + this.send.stringData;
            }
            catch (Exception ex)
            {
                this.debugwindow.DebugLog = "[" + this + "]" + ex.Message;
            }
        }