Exemple #1
0
        private void LoadDefaults()
        {
            Executable server = new Executable()
            {
                Settings      = this,
                Name          = "Server",
                Path          = "casparcg.exe",
                AllowCommands = true,
                AutoStart     = true
            };
            Executable scanner = new Executable()
            {
                Settings      = this,
                Name          = "Scanner",
                Path          = "scanner.exe",
                AllowCommands = false,
                AutoStart     = true
            };

            Executables.Add(server);
            Executables.Add(scanner);
        }
Exemple #2
0
        private void Launcher_KeyUp(object sender, KeyEventArgs e)
        {
            if (Keyboard.IsKeyUp(Key.LeftShift) || Keyboard.IsKeyUp(Key.RightShift))
            {
                IsShiftDown = false;
            }

            IInputElement focused = FocusManager.GetFocusedElement(this);

            if (focused is TextBox)
            {
                TextBox target = focused as TextBox;
                if (target.Name == "ConsoleCommandTextBox")
                {
                    object     context    = target.DataContext;
                    Executable executable = (context is Executable) ? context as Executable : null;
                    if (executable is null || !executable.AllowCommands)
                    {
                        return;
                    }

                    if (e.Key == Key.Enter)
                    {
                        executable.Write();
                    }
                    if (e.Key == Key.Up)
                    {
                        executable.PreviousHistoryCommand();
                        target.CaretIndex = target.Text.Length;
                    }
                    if (e.Key == Key.Down)
                    {
                        executable.NextHistoryCommand();
                        target.CaretIndex = target.Text.Length;
                    }
                }
            }
        }
Exemple #3
0
        private void ParseSettings(string settings)
        {
            try
            {
                XElement executables = XElement.Parse(settings);
                Debug.WriteLine(executables.ToString());
                foreach (XElement executable in executables.Elements())
                {
                    Debug.WriteLine("ELEMENT: ");
                    Debug.WriteLine(executable.Element("path").ToString());

                    Executable new_executable = new Executable()
                    {
                        Settings      = this,
                        Path          = executable.Element("path").Value,
                        Name          = executable.Element("name").Value,
                        Args          = executable.Element("args").Value,
                        AutoStart     = bool.Parse(executable.Element("auto").Value),
                        StartupDelay  = int.Parse(executable.Element("sdel").Value),
                        AllowCommands = bool.Parse(executable.Element("acmd").Value),
                        CommandsDelay = int.Parse(executable.Element("cdel").Value)
                    };
                    foreach (XElement command in executable.Element("commands").Descendants())
                    {
                        Command new_command = new Command()
                        {
                            Value = command.Value
                        };
                        new_executable.Commands.Add(new_command);
                    }
                    Executables.Add(new_executable);
                }
            }
            catch (Exception e)
            {
                LoadDefaults();
            }
        }
Exemple #4
0
 public ExecutableEventArgs(Executable executable)
 {
     Executable = executable;
 }
Exemple #5
0
        private void StopButton_Click(object sender, RoutedEventArgs e)
        {
            Executable executable = ((FrameworkElement)sender).DataContext as Executable;

            executable.Stop();
        }
Exemple #6
0
        // Status TabItem UI Handlers

        private void ExecutableButton_Click(object sender, RoutedEventArgs e)
        {
            Executable exec = ((FrameworkElement)sender).DataContext as Executable;

            exec.IsSelected = true;
        }
Exemple #7
0
 protected virtual void OnExecutableExited(Executable ex)
 {
     ExecutableExited?.Invoke(this, new ExecutableEventArgs(ex));
 }
Exemple #8
0
 protected virtual void OnExecutablePathError(Executable ex)
 {
     ExecutablePathError?.Invoke(this, new ExecutableEventArgs(ex));
 }
Exemple #9
0
        private void ExecutableConfig_Click(object sender, RoutedEventArgs e)
        {
            Executable ex = ((FrameworkElement)sender).DataContext as Executable;

            OpenExecutableConfig(ex);
        }