コード例 #1
0
        /// <summary>
        /// オーバーロードコンストラクタ
        /// 各種設定を追加
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="name"></param>
        public StreamWindow(MainWindow parent, StreamClient SC)
        {
            try
            {
                InitializeComponent();
                this.MouseLeftButtonDown += (sender, e) => this.DragMove();
                this.Closing += StreamWindow_Closing;

                this.SC = SC;
                this.TitleText.Text = this.SC.name;
                this.textblock_settingdata.Text
                    = "MyPort : " + this.SC.myport.ToString() + "\n"
                    + "ServerIP : " + this.SC.serverIP + "\n"
                    + "ServerPort : " + this.SC.serverport.ToString() + "\n"
                    + "Mode : " + this.SC.mode.ToString() + "\n"
                    + "FPS : " + this.SC.fps.ToString() + "\n"
                    + "filepath : " + this.SC.filename;

                #region set button and file open.
                switch (this.SC.mode)
                {
                    case MODE.Sender:
                        this.Button_Start.IsEnabled = true;
                        this.Button_RecStart.IsEnabled = false;
                        this.reader = new BinaryReader(File.OpenRead(this.SC.filename));
                        this.progressbar_datastream.Maximum = this.reader.BaseStream.Length;
                        break;
                    case MODE.Receiver:
                        this.Button_Start.IsEnabled = false;
                        this.Button_RecStart.IsEnabled = true;
                        this.writer = new BinaryWriter(File.OpenWrite(this.SC.filename));
                        break;
                    default:
                        break;
                }

                #endregion

                this.cipc = new CIPC_CS.CLIENT.CLIENT(this.SC.myport, this.SC.serverIP, this.SC.serverport, this.SC.name, this.SC.fps);
                this.CTS = new System.Threading.CancellationTokenSource();

                this.Fps_cipc = new FPSAdjuster.FPSAdjuster();
                this.Fps_cipc.Fps = this.SC.fps;

                this.task = new Task(() => maintask(), this.CTS.Token);
                this.task.Start();

                this.parent = parent;
                this.IsRecStarted = false;
                this.IsSendStarted = false;
                this.IsClosed = false;

                this.textblock_settingdata.ToolTip = this.textblock_settingdata.Text;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.Close();
            }
        }
コード例 #2
0
        /// <summary>
        /// オーバーロードコンストラクタ
        /// 各種設定を追加
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="name"></param>
        public StreamWindow(MainWindow parent, StreamClient SC)
        {
            InitializeComponent();
            this.MouseLeftButtonDown += (sender, e) => this.DragMove();
            this.Closing             += StreamWindow_Closing;

            this.SC             = SC;
            this.TitleText.Text = this.SC.name;
            this.textblock_settingdata.Text
                = "MyPort : " + this.SC.myport.ToString() + "\n"
                  + "ServerIP : " + this.SC.serverIP + "\n"
                  + "ServerPort : " + this.SC.serverport.ToString() + "\n"
                  + "Mode : " + this.SC.mode.ToString() + "\n"
                  + "FPS : " + this.SC.fps.ToString() + "\n"
                  + "filepath : " + this.SC.filename + "\n";


            #region set button and file open.
            switch (this.SC.mode)
            {
            case MODE.Sender:
                this.Button_Start.IsEnabled    = true;
                this.Button_RecStart.IsEnabled = false;
                this.reader = new BinaryReader(File.OpenRead(this.SC.filename));
                this.progressbar_datastream.Maximum = this.reader.BaseStream.Length;
                break;

            case MODE.Receiver:
                this.Button_Start.IsEnabled    = false;
                this.Button_RecStart.IsEnabled = true;
                this.writer = new BinaryWriter(File.OpenWrite(this.SC.filename));
                break;

            default:
                break;
            }

            #endregion



            this.cipc = new CIPC_CS.CLIENT.CLIENT(this.SC.myport, this.SC.serverIP, this.SC.serverport, this.SC.name, this.SC.fps);
            this.CTS  = new System.Threading.CancellationTokenSource();

            this.Fps_cipc     = new FPSAdjuster.FPSAdjuster();
            this.Fps_cipc.Fps = this.SC.fps;

            this.task = new Task(() => maintask(), this.CTS.Token);
            this.task.Start();

            this.parent        = parent;
            this.IsRecStarted  = false;
            this.IsSendStarted = false;
            this.IsClosed      = false;
        }
コード例 #3
0
        private void StreamWindowLunchButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.CheckStreamWindows();
                if (this.TextBox_FinalFileName.Text == "")
                {
                    this.Button_NameUpdate_Click(sender, e);
                }
                #region StreamClientSetting

                StreamClient SC = new StreamClient();
                SC.name       = this.textbox_clientname.Text;
                SC.myport     = int.Parse(this.textbox_clientmyport.Text);
                SC.serverIP   = this.remoteIP.Text;
                SC.serverport = int.Parse(this.textbox_serverport.Text);
                if (this.radiobutton_sender.IsChecked == true)
                {
                    SC.mode = MODE.Sender;
                }
                else if (this.radiobutton_receiver.IsChecked == true)
                {
                    SC.mode = MODE.Receiver;
                }
                else
                {
                    MessageBox.Show("error." + this.ToString());
                }
                SC.fps      = int.Parse(this.textbox_fps.Text);
                SC.filename = this.TextBox_FinalFileName.Text;
                #endregion

                StreamWindow sw = new StreamWindow(this, SC);
                this.List_SW.Add(sw);
                sw.Show();
                this.ListProvider_SW.Refresh();
                this.textbox_clientmyport.Text = (int.Parse(this.textbox_clientmyport.Text) + 1).ToString();
                this.AutoFileNameNumber++;
                this.TextBlock_AutoNumber.Text = this.AutoFileNameNumber.ToString();
                this.Button_NameUpdate_Click(sender, e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #4
0
        private void StreamWindowLunchButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.CheckStreamWindows();

                #region StreamClientSetting

                StreamClient SC = new StreamClient();
                SC.name       = this.textbox_clientname.Text;
                SC.myport     = int.Parse(this.textbox_clientmyport.Text);
                SC.serverIP   = this.remoteIP_1.Text + "." + this.remoteIP_2.Text + "." + this.remoteIP_3.Text + "." + this.remoteIP_4.Text;
                SC.serverport = int.Parse(this.textbox_serverport.Text);
                if (this.radiobutton_sender.IsChecked == true)
                {
                    SC.mode = MODE.Sender;
                }
                else if (this.radiobutton_receiver.IsChecked == true)
                {
                    SC.mode = MODE.Receiver;
                }
                else
                {
                    MessageBox.Show("error." + this.ToString());
                }
                SC.fps      = int.Parse(this.textbox_fps.Text);
                SC.filename = this.textbox_filename.Text;
                #endregion

                StreamWindow sw = new StreamWindow(this, SC);
                sw.Show();
                this.List_SW.Add(sw);
                this.textbox_clientmyport.Text = (int.Parse(this.textbox_clientmyport.Text) + 1).ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #5
0
        private void StreamWindowLunchButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.CheckStreamWindows();
                if (this.TextBox_FinalFileName.Text == "")
                {
                    this.Button_NameUpdate_Click(sender, e);
                }
                #region StreamClientSetting

                StreamClient SC = new StreamClient();
                SC.name = this.textbox_clientname.Text;
                SC.myport = int.Parse(this.textbox_clientmyport.Text);
                SC.serverIP = this.remoteIP.Text;
                SC.serverport = int.Parse(this.textbox_serverport.Text);
                if (this.radiobutton_sender.IsChecked == true)
                {
                    SC.mode = MODE.Sender;
                }
                else if (this.radiobutton_receiver.IsChecked == true)
                {
                    SC.mode = MODE.Receiver;
                }
                else
                {
                    MessageBox.Show("error." + this.ToString());
                }
                SC.fps = int.Parse(this.textbox_fps.Text);
                SC.filename = this.TextBox_FinalFileName.Text;
                #endregion

                StreamWindow sw = new StreamWindow(this, SC);
                this.List_SW.Add(sw);
                sw.Show();
                this.ListProvider_SW.Refresh();
                this.textbox_clientmyport.Text = (int.Parse(this.textbox_clientmyport.Text) + 1).ToString();
                this.AutoFileNameNumber++;
                this.TextBlock_AutoNumber.Text = this.AutoFileNameNumber.ToString();
                this.Button_NameUpdate_Click(sender, e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #6
0
        private void StreamWindowLunchButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.CheckStreamWindows();

                #region StreamClientSetting

                StreamClient SC = new StreamClient();
                SC.name = this.textbox_clientname.Text;
                SC.myport = int.Parse(this.textbox_clientmyport.Text);
                SC.serverIP = this.remoteIP_1.Text + "." + this.remoteIP_2.Text + "." + this.remoteIP_3.Text + "." + this.remoteIP_4.Text;
                SC.serverport = int.Parse(this.textbox_serverport.Text);
                if (this.radiobutton_sender.IsChecked == true)
                {
                    SC.mode = MODE.Sender;
                }
                else if (this.radiobutton_receiver.IsChecked == true)
                {
                    SC.mode = MODE.Receiver;
                }
                else
                {
                    MessageBox.Show("error." + this.ToString());
                }
                SC.fps = int.Parse(this.textbox_fps.Text);
                SC.filename = this.textbox_filename.Text;
                #endregion

                StreamWindow sw = new StreamWindow(this, SC);
                sw.Show();
                this.List_SW.Add(sw);
                this.textbox_clientmyport.Text = (int.Parse(this.textbox_clientmyport.Text) + 1).ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }