Exemplo n.º 1
0
        private static void MasterIpButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            string ip = InputDialogCtrl.Show("Enter PB IP and Domain");

            if (ip != null)
            {
                string[] a = ip.Split(' ');
                if (a.Length >= 2)
                {
                    Match match = Regex.Match(a[0], @"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$");

                    if (match.Success && int.TryParse(a[1], out int domain))
                    {
                        Connect(a[0], domain);
                        MidiController.Connect(ip);
                    }
                    else
                    {
                        DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't connect to PB!", "You entered an invalid IP or domain.");
                    }
                }
                else
                {
                    DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't connect to PB!", "You entered an invalid IP or domain.");
                }
            }
        }
Exemplo n.º 2
0
        private static void AddBeamerButton_Click(object sender, RoutedEventArgs e)
        {
            string s = InputDialogCtrl.Show("Enter: ID IP");

            if (s != null)
            {
                string[] a = s.Split(' ');
                if (a.Length >= 2)
                {
                    int id;
                    if (!int.TryParse(a[0], out id))
                    {
                        DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't add beamer!", "Invalid ID.");
                    }
                    else
                    {
                        Match match = Regex.Match(a[1], @"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
                        if (!match.Success)
                        {
                            DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't add beamer!", "Invalid IP.");
                        }
                        else
                        {
                            AddProjector(id, a[1]);
                        }
                    }
                    CuelistCtrl.saved = false;
                }
                else
                {
                    DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't add beamer!", "Invalid text input.");
                }
            }
        }
Exemplo n.º 3
0
        private static void MatrixIpButton_Click(object sender, RoutedEventArgs e)
        {
            string s = InputDialogCtrl.Show("Enter Master IP");

            if (s != null)
            {
                Match match = Regex.Match(s, @"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
                if (match.Success)
                {
                    SetIp(s);
                }
                else
                {
                    DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't set Matrix IP!", "You entered an invalid IP address.");
                }
            }
        }
Exemplo n.º 4
0
        private static void MatrixPresetButton_Click(object sender, RoutedEventArgs e)
        {
            string s = InputDialogCtrl.Show("Enter preset number");

            if (s != null)
            {
                int preset;
                if (int.TryParse(s, out preset))
                {
                    MatrixCmd cmdBuff = MatrixCmd.getMatrixCmd("P" + preset);
                    SendMatrixCmd(cmdBuff);
                }
                else
                {
                    DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't load preset!", "You entered an invalid preset number.");
                }
            }
        }
Exemplo n.º 5
0
        private static void AddOscButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            string s = InputDialogCtrl.Show("Enter: Keyword Prefix IP Port", 300);

            if (s != null)
            {
                string[] buff = s.Split(' ');
                if (buff.Length >= 4)
                {
                    if (!buff[1].StartsWith("/"))
                    {
                        DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Wrong prefix format.", "OSC addresses have to start with /");
                    }
                    else if (buff[1].EndsWith("/"))
                    {
                        DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Wrong prefix format.", "Prefix cannot end with /");
                    }
                    else
                    {
                        Match match = Regex.Match(buff[2], @"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$");
                        if (!match.Success)
                        {
                            DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't add OSC target!", "Invalid IP.");
                        }
                        else
                        {
                            if (!int.TryParse(buff[3], out int port))
                            {
                                DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't add OSC target!", "Invalid Port.");
                            }
                            else
                            {
                                AddOscTarget(buff[0], buff[1], IPAddress.Parse(buff[2]), port, s);
                            }
                        }
                    }
                }
                else
                {
                    DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Wrong Format!", "Enter ID (chosen by you), IP and Port.");
                }
            }
        }
Exemplo n.º 6
0
        private static void MainModeButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            string ip = InputDialogCtrl.Show("Enter Backup IP:");

            if (ip != null)
            {
                Match match = Regex.Match(ip, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}");
                if (match.Success)
                {
                    Properties.Settings.Default.backup = ip;
                    Properties.Settings.Default.Save();
                    LogCtrl.Warning("Setting to Main. (Backup: " + ip + ")");
                    LogCtrl.Warning("Restart CueController now.");
                }
                else
                {
                    DialogCtrl.Show(DialogType.ERROR, OptionType.OKCANCEL, "Can't set to Main!", "You entered an invalid IP address.");
                }
            }
        }