Пример #1
0
        private void buttonChooseNetworkMachine_Click(object sender, RoutedEventArgs e)
        {
            var nmcw = new NetworkMachineChoiceWindow();

            var result = nmcw.ShowDialog();

            if (result == true)
            {
                NetworkMachine machine = nmcw.GetNetworkMachine();

                if (machine == null)
                {
                    return;
                }

                if (!string.IsNullOrEmpty(machine.Name))
                {
                    this.textBoxName.Text = machine.Name;
                }
                else if (machine.IPAddress != null)
                {
                    this.textBoxIPAddress.Text = machine.IPAddress.ToString();
                }
            }
        }
Пример #2
0
        public NetworkMachineChoiceWindow()
        {
            InitializeComponent();

            //this.busyIndicator.BusyContent = Wsapm.Resources.Wsapm.General_BusyIndicatorBusyContent;
            this.chosenComputer = null;
        }
Пример #3
0
 public NetClient(NetworkGamer g)
 {
     machine             = g.Machine;
     gamer               = g;
     serverState         = 0;
     isPublicSlotRequest = false;
     playerSlots         = new bool[16];
     tileSection         = new bool[127, 49];
 }
Пример #4
0
        private void networkMachineDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var machine = this.networkMachineDataGrid.SelectedItem as NetworkMachine;

            if (machine != null)
            {
                this.chosenComputer = machine;
                this.DialogResult   = true;
                this.Close();
            }
        }
Пример #5
0
        private bool NetworkMachineFilter(object item)
        {
            NetworkMachine machine = item as NetworkMachine;

            if (machine == null)
            {
                return(false);
            }

            return(machine.Name.ToLower().Contains(this.textBoxFilter.Text.ToLower()) || machine.IPAddress.ToString().Contains(this.textBoxFilter.Text.ToLower()));
        }
Пример #6
0
        public AddNetworkMachineWindow(NetworkMachine networkMachineToEdit, NetworkMachine[] allNetworkMachines)
            : this(allNetworkMachines)
        {
            this.Title = Wsapm.Resources.Wsapm.AddNetworkMachineWindow_TitleEdit;
            this.editNetworkMachineCopy = networkMachineToEdit.Copy();
            this.textBoxName.Text       = networkMachineToEdit.Name;

            if (networkMachineToEdit.IPAddress != null)
            {
                this.textBoxIPAddress.Text = networkMachineToEdit.IPAddress.ToString();
            }
        }
Пример #7
0
        private void buttonOK_Click(object sender, RoutedEventArgs e)
        {
            var machine = this.networkMachineDataGrid.SelectedItem as NetworkMachine;

            if (machine != null)
            {
                this.chosenComputer = machine;
            }

            this.DialogResult = true;
            this.Close();
        }
Пример #8
0
        private void buttonOK_Click(object sender, RoutedEventArgs e)
        {
            var name = this.textBoxName.Text.Trim();
            var ip   = this.textBoxIPAddress.Text;

            var machine = new NetworkMachine();

            if (!string.IsNullOrEmpty(name))
            {
                machine.Name = name;
            }

            if (!string.IsNullOrEmpty(ip))
            {
                if (NetworkTools.IsStringIPAddress(ip))
                {
                    machine.IPAddress = IPAddress.Parse(ip);
                }
                else
                {
                    MessageBox.Show(Wsapm.Resources.Wsapm.AddNetworkMachineWindow_MessageIPNoRealIP, Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }

            if (string.IsNullOrEmpty(machine.Name) && machine.IPAddress == null)
            {
                MessageBox.Show(String.Format(Wsapm.Resources.Wsapm.AddNetworkMachineWindow_NoInfoError, Environment.NewLine), Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            // Avoid to add a element twice.
            if (this.editNetworkMachineCopy == null)
            {
                // Add new mode.
                if (this.allNetworkMachines != null)
                {
                    for (int i = 0; i < this.allNetworkMachines.Length; i++)
                    {
                        if (this.allNetworkMachines[i] == machine)
                        {
                            MessageBox.Show(String.Format(Wsapm.Resources.Wsapm.AddNetworkMachineWindow_NetworkMachineAlreadyAdded, machine.ToString()), Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                    }
                }
            }
            else
            {
                // Edit mode.
                if (machine == this.editNetworkMachineCopy)
                {
                    // Element was not changed.
                    this.DialogResult = false;
                    this.Close();
                    return;
                }
                else
                {
                    // Element was changed.
                    if (this.allNetworkMachines != null)
                    {
                        for (int i = 0; i < this.allNetworkMachines.Length; i++)
                        {
                            if (this.allNetworkMachines[i] == machine)
                            {
                                MessageBox.Show(String.Format(Wsapm.Resources.Wsapm.AddNetworkMachineWindow_NetworkMachineAlreadyAdded, machine.ToString()), Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                                return;
                            }
                        }
                    }
                }
            }

            this.networkMachine = machine;
            this.DialogResult   = true;
            this.Close();
        }