예제 #1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="localPort">自分のポート</param>
        public RemoteHost(int localPort, DebugWindow debugwindow/*, TerminalConnection.TerminalConnection TC*/)
        {
            try
            {
                this.UP_Cliant = new UDP_PACKETS_CLIANT.UDP_PACKETS_CLIANT(localPort);
                this.UP_Encoder = new UDP_PACKETS_CODER.UDP_PACKETS_ENCODER();
                this.UP_Decoder = new UDP_PACKETS_CODER.UDP_PACKETS_DECODER();
                this.id = localPort;

                this.CTS = new CancellationTokenSource();
                this.mytask = new Task(() => this.Main_Task(), CTS.Token);

                this.mytask.Start();
                this.fpsa = new FPSAdjuster.FPSAdjuster();

                this.debugwindow = debugwindow;
                this.debugwindow.DebugLog = "[Port:" + localPort.ToString() + "]受信を開始します";

                //this.TC = TC;
            }
            catch (Exception ex)
            {
                while (true)
                {
                    myDialog dialog = new myDialog(ex.Message);
                    if (dialog.ShowDialog() == true)
                    {
                        break;
                    }
                }
            }
        }
예제 #2
0
        public MainWindow()
        {
            try
            {
                int minWorkerThread, minCompletionPortThread;
                ThreadPool.GetMinThreads(out minWorkerThread, out minCompletionPortThread);
                ThreadPool.SetMinThreads(1000, minCompletionPortThread);

                #region window initialize
                this.Title = "CentralInterProcessCommunicationServer";
                this.MouseLeftButtonDown += (sender, e) => this.DragMove();

                this.Closing += MainWindow_Closing;
                #endregion

                #region DispatcherTimer

                dispatchertimer = new DispatcherTimer(DispatcherPriority.Normal);
                dispatchertimer.Interval = new TimeSpan(0, 0, 1);
                dispatchertimer.Tick += dispatchertimer_Tick;
                dispatchertimer.Start();

                #endregion DispatcherTimer

                try
                {
                    #region Minimizedwindow and debugwindow
                    this.debugwindow = new DebugWindow();
                    this.minimizedwindow = new MinimizedWindow();
                    this.minimizedwindow.mainwindow = this;
                    #endregion
                    #region RemoteHostServer
                    this.rhServer = new RemoteHostServer();
                    this.rhServer.debugwindow = this.debugwindow;
                    #endregion
                    #region DataConnectionServer
                    this.DCS = new DATA_CONNECTION.DataConnectionServer();
                    this.DCS.debugwindow = this.debugwindow;
                    #endregion
                    #region TerminalConnection
                    //this.TC = new TerminalConnection.TerminalConnection();
                    //this.TC.debugwindow = this.debugwindow;
                    //this.TC.RHS = this.rhServer;
                    //this.TC.DCS = this.DCS;
                    //this.TC.mainwindow = this;
                    //this.AddTCFunction();
                    this.AddRemoteOperateFunction();

                    //this.rhServer.terminalconnection = this.TC;
                    #endregion
                    #region ProcessList
                    this.List_Processes = new List<System.Diagnostics.Process>();
                    #endregion
                    this.rhServer.parent = this;
                    InitializeComponent();
                    debugwindow.DebugLog = "[CIPCServer]CIPCServerを開始します.";
                }
                catch (Exception ex)
                {
                    while (true)
                    {
                        myDialog dialog = new myDialog(ex.Message);
                        if (dialog.ShowDialog() == true)
                        {
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                while (true)
                {
                    myDialog dialog = new myDialog(ex.Message);
                    if (dialog.ShowDialog() == true)
                    {
                        break;
                    }
                }
            }
        }