コード例 #1
0
        public Form1()
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;

            NetCard.NetCard n         = new NetCard.NetCard();
            string          ipAddress = n.getComputerIP();
            clsRegistry     reg       = new clsRegistry();

            if (ipAddress == "0.0.0.0")
            {
                string bip = reg.GetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Field", "IpAddress");
                if (reg.strRegError == null)
                {
                }
                else
                {
                    GetManualIpAddress g = new GetManualIpAddress();
                    if (g.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        ipAddress = g.IpAddress;
                        reg.SetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Field", "IpAddress", ipAddress);
                    }
                }
            }
            label5.Visible = true;
            label5.Text    = ipAddress;
            label1.Text    = "Goji MPFM Watson WCF Field installation version " + Properties.Settings.Default.WatsonInstallerVersion;
            ThreadedExecuter <string> executer = new ThreadedExecuter <string>(ProcessThread_1, ThreadCompleted);

            executer.Start();
        }
コード例 #2
0
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("please select upload type");
                return;
            }

            clsRegistry reg = new clsRegistry();

            m_baseGuid = reg.GetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Base", "Guid");
            if (reg.strRegError != null)
            {
                m_baseGuid = Guid.NewGuid().ToString();
                reg.SetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Base", "Guid", m_baseGuid);
            }
            string guid = m_client.GetClientGuid();

            NetCard.NetCard n      = new NetCard.NetCard();
            string          baseIp = n.getComputerIP();

            if (baseIp == "0.0.0.0")
            {
                string bip = reg.GetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Base", "IpAddress");
                if (reg.strRegError == null)
                {
                    baseIp = bip;
                }
                else
                {
                    MessageBox.Show("You need to specify the base ip address in the registry");
                    return;
                }
            }

            if (checkBox1.Checked == true)
            {
                if (comboBox1.SelectedIndex == 0)
                {
                    try
                    {
                        Dictionary <string, string> storageDirectoryDic = new Dictionary <string, string>();
                        storageDirectoryDic.Add(guid, textBox3.Text);
                        GojiWCFStreamingBase.StartStorageServer(storageDirectoryDic);


                        if (SetCopyTimerEvent() == false)
                        {
                            return;
                        }
                        m_client.AddDateToUploadTargetFolder(checkBox8.Checked);
                        m_client.ConnectToStreamingServer(baseIp, textBox4.Text, textBox5.Text);
                        button14.Enabled = true;
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show(err.Message);
                    }
                }
                else if (comboBox1.SelectedIndex == 1)
                {
                    try
                    {
                        string s = m_client.InitializeDropBox();
                        if (s != "ok")
                        {
                            MessageBox.Show(s);
                        }
                        else
                        {
                            m_client.StartDropBoxUploadMode(true);
                            button14.Enabled = true;
                        }
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show(err.Message);
                    }
                }
                else if (comboBox1.SelectedIndex == 2)
                {
                    m_client.StartTCPStreamingServer(1024 * 1024 * 30, 5005);
                    m_client.OpenTCPStreamingClient(baseIp, textBox4.Text, textBox5.Text);
                }
                checkBox1.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                if (comboBox1.SelectedIndex == 0)
                {
                    m_client.CloseCopyThread();
                    while (m_client.IsCopyThreadIsAlive() == true)
                    {
                        Application.DoEvents();
                        Thread.Sleep(1000);
                    }
                }
                else
                {
                    try
                    {
                        m_client.StartDropBoxUploadMode(false);
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show(err.Message);
                    }
                }
                checkBox1.ForeColor = System.Drawing.Color.Red;
            }
        }
コード例 #3
0
        public Form1()
        {
            m_running = true;
            InitializeComponent();
            label18.Text = m_totalFieldFiles.ToString();
            Control.CheckForIllegalCrossThreadCalls = false;

            groupBox3.Enabled = false;
            p  = new GojiWCFStreamingBase.ClientCallbackMessage(ClientCallbackMsg);
            p1 = new GojiWCFStreamingBase.ServerCallbackMessage(ServerCallbackMsg);
            GojiWCFStreamingBase.SetServerCallback = p1;
            m_client = new GojiWCFStreamingBase(p);

            textBox1.Text = Properties.Settings.Default.FieldIpAddress;
            textBox7.Text = Properties.Settings.Default.FieldComputerUserName;
            textBox6.Text = Properties.Settings.Default.FieldComputerPassword;

            textBox4.Text           = Properties.Settings.Default.StorageServerUserName;
            textBox5.Text           = Properties.Settings.Default.StorageServerPassword;
            textBox2.Text           = Properties.Settings.Default.FieldDirectoryToMinotor;
            textBox3.Text           = Properties.Settings.Default.StorageDirectoryToUpload;
            comboBox1.SelectedIndex = Properties.Settings.Default.UploadMode;
            textBox10.Text          = Properties.Settings.Default.DeleteAllUploadedFilesTimer;
            textBox12.Text          = Properties.Settings.Default.uploadWrongFilesDirectory;
            textBox13.Text          = Properties.Settings.Default.SyncDirectory;
            checkBox4.Checked       = Properties.Settings.Default.RecoursiveSync;
            textBox14.Text          = Properties.Settings.Default.OperatorUserName;
            checkBox6.Checked       = Properties.Settings.Default.OperationsByUser;
            button14.Enabled        = false;

            try
            {
                MapNetworkDrives();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }


            NetCard.NetCard n      = new NetCard.NetCard();
            string          baseIp = n.getComputerIP();

            if (baseIp == "0.0.0.0")
            {
                clsRegistry reg = new clsRegistry();
                string      bip = reg.GetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Base", "IpAddress");
                if (reg.strRegError == null)
                {
                    baseIp    = bip;
                    this.Text = "Goji Field uploaded managment " + baseIp;
                }
                else
                {
                    MessageBox.Show("You need to specify the base ip address in the registry");
                    GetManualIpAddress g = new GetManualIpAddress();
                    g.ShowDialog();
                    if (g.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        baseIp    = g.IpAddress;
                        this.Text = "Goji Field uploaded managment " + baseIp;
                        reg.SetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Base", "IpAddress", baseIp);
                    }
                    return;
                }
            }
            else
            {
                this.Text = "Goji Field uploaded managment " + baseIp;
            }
        }
コード例 #4
0
        private void checkBox9_CheckedChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("please select upload type");
                return;
            }
            if (checkBox1.Checked == true)
            {
                if (comboBox1.SelectedIndex == 0)
                {
                    try
                    {
                        clsRegistry reg = new clsRegistry();
                        m_baseGuid = reg.GetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Base", "Guid");
                        if (reg.strRegError != null)
                        {
                            m_baseGuid = Guid.NewGuid().ToString();
                            reg.SetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Base", "Guid", m_baseGuid);
                        }

                        string guid = m_client.GetClientGuid();
                        m_client.StartTCPStreamingServer(1024 * 1024 * 10, 5005);

                        NetCard.NetCard n      = new NetCard.NetCard();
                        string          baseIp = n.getComputerIP();
                        if (baseIp == "0.0.0.0")
                        {
                            string bip = reg.GetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Base", "IpAddress");
                            if (reg.strRegError == null)
                            {
                                baseIp = bip;
                            }
                            else
                            {
                                MessageBox.Show("You need to specify the base ip address in the registry");
                                return;
                            }
                        }
                        if (SetCopyTimerEvent() == false)
                        {
                            return;
                        }
                        m_client.OpenTCPStreamingClient(baseIp, textBox4.Text, textBox5.Text);
                        button14.Enabled = true;
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show(err.Message);
                    }
                }
                else
                {
                }
                checkBox1.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                checkBox1.ForeColor = System.Drawing.Color.Red;
            }
        }