示例#1
0
        // Get your external ip from internet
        public void GetIPAndSet()
        {
            Get    getIp = new Get();
            string ip    = getIp.GetPublicIP();

            try
            {
                if (ip != null)
                {
                    Data.MainWin.Dispatcher.Invoke(new Action(delegate()
                    {
                        IPInput.Text             = ip;
                        Data.MainWin.YourIp.Text = Data.SettingCh.St.IP;
                    }));


                    Data.SettingCh.St.IP = ip;
                }
                else
                {
                    Data.MainWin.Dispatcher.Invoke(new Action(delegate()
                    {
                        UseIpStatic.IsChecked = false;
                        IPInput.IsEnabled     = true;
                        IPInput.Tag           = "automatic detection does not work, enter manually";
                    }));
                }
            }
            catch { }

            Data.MainWin.CheckServerIpPorts();
        }
示例#2
0
        // Get your external ip from the internet
        public void GetIPAndSet()
        {
            Get getIp = new Get();

            try
            {
                string ip = getIp.GetPublicIP();
                if (ip != null)
                {
                    if (Data.MainWin != null)
                    {
                        Data.MainWin.Dispatcher.Invoke(new Action(delegate()
                        {
                            YourIp.Text = ip;
                            if (Data.SettingCh.St.Server != null || Data.SettingCh.St.Server != "")
                            {
                                Create.IsEnabled = true;
                            }
                        }));

                        Data.SettingCh.St.IP = ip;
                    }
                }
                else
                {
                    if (Data.MainWin != null)
                    {
                        Data.MainWin.Dispatcher.Invoke(new Action(delegate()
                        {
                            YourIp.Text = "Input your IP for local modul in settings";
                        }));
                    }
                }
            }
            catch { }
        }