コード例 #1
0
        public void IniFormMain()
        {
            tip1.UseFading = false;
            tip1.UseAnimation = false;
            tip1.ShowAlways = false;
            tip1.InitialDelay = 500;

            tip2.UseFading = false;
            tip2.UseAnimation = false;
            tip2.ShowAlways = false;
            tip2.InitialDelay = 500;

            tip1.SetToolTip(btnResetFormat, "Löscht das aktuelle Format,\n sodass wieder normaler Text geschrieben werden kann.");
            tip2.SetToolTip(btnKopieren, "Makiert den gesamten Text und kopiert ihn in die Zwischenablage.");

            this.TopMost = true;
            ResetPosition();

            FormMain.HistoryStackSize = 20;

            Program.fmEinstellungen.cbSendModes.Items.Add("Alle Clienten gleichzeitig");
            Program.fmEinstellungen.cbSendModes.Items.Add("Client für Client");
            Program.fmEinstellungen.cbSendModes.SelectedIndex = 0;

            try
            {
                tbMessage.LostFocus += new EventHandler(tbMessage_LostFocus);

                //IPHostEntry r = Dns.GetHostEntry(IPAddress.Loopback); //klappt nur bei win 7/8
                IPHostEntry rr = Dns.GetHostEntry(Dns.GetHostName()); //klappt auch bei Win xp

                var result = rr.AddressList.Where((ipadd) => ipadd.AddressFamily == AddressFamily.InterNetwork && ipadd.ToString() != "127.0.0.1").ToList();

                if (result.Count >= 1 && rr.HostName != "")
                {

                    //tbMessage.Text = "Eigene IP: " + result[0].ToString();// +" : " + Port.ToString();
                    tbMessage.Text = "Eigener Dns Name: " + rr.HostName;// +" : " + Port.ToString();
                    Server = new ServerContext(Port, 50, ref TextHistory, result[0].ToString());
                }
                else
                {
                    MessageBox.Show("Server konnte nicht gestartet werden: Dns Name nicht gefunden", "Dns Name nicht gefunden");
                    Program.Exit();
                }

                Server.DoListen();

            }
            catch (Exception m)
            {
                MessageBox.Show(m.Message);
            }
            SetLeaveOpacity();
        }
コード例 #2
0
ファイル: FormMain.cs プロジェクト: janis2013/TextVerteiler
        public void IniFormMain()
        {
            this.TopMost = true;
            ResetPosition();

            FormMain.HistoryStackSize = 20;

            try
            {
                tbMessage.LostFocus += new EventHandler(tbMessage_LostFocus);

                IPHostEntry r = Dns.GetHostEntry(IPAddress.Loopback);

                var result = r.AddressList.Where((ipadd) => ipadd.AddressFamily == AddressFamily.InterNetwork && ipadd.ToString() != "127.0.0.1").ToList();

                if (result.Count >= 1)
                {

                    tbMessage.Text = "Eigene IP: " + result[0].ToString();// +" : " + Port.ToString();

                }

                Server = new ServerContext(Port, 50, ref TextHistory);

                Server.DoListen();

            }
            catch (Exception m)
            {
                MessageBox.Show(m.Message);
            }
            SetLeaveOpacity();
        }