Ejemplo n.º 1
0
        private void button_add_srvcoop_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SetCoopSrvWindow dlg = new SetCoopSrvWindow();
                dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual;
                if (dlg.ShowDialog() == true)
                {
                    String ip   = "";
                    UInt32 port = 4510;
                    dlg.GetSetting(ref ip, ref port);

                    bool find = false;
                    foreach (CoopServerInfo info in listBox_coopSrv.Items)
                    {
                        if (String.Compare(info.ServerAddress, ip) == 0)
                        {
                            MessageBox.Show("すでに登録されているアドレスです");
                            return;
                        }
                    }

                    if (find == false)
                    {
                        CoopServerInfo item = new CoopServerInfo();
                        item.ServerAddress = ip;
                        item.ServerPort    = port;

                        listBox_coopSrv.Items.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
        private void button_add_srvcoop_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SetCoopSrvWindow dlg = new SetCoopSrvWindow();
                dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual;
                if (dlg.ShowDialog() == true)
                {
                    String ip = "";
                    UInt32 port = 4510;
                    dlg.GetSetting(ref ip, ref port);

                    bool find = false;
                    foreach (CoopServerInfo info in listBox_coopSrv.Items)
                    {
                        if (String.Compare(info.ServerAddress, ip) == 0)
                        {
                            MessageBox.Show("すでに登録されているアドレスです");
                            return;
                        }
                    }

                    if (find == false)
                    {
                        CoopServerInfo item = new CoopServerInfo();
                        item.ServerAddress = ip;
                        item.ServerPort = port;

                        listBox_coopSrv.Items.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }