public MainWindow(OctoPrintArgs args)
        {
            opArgs = args;

            InitializeComponent();

            GetState();
        }
Esempio n. 2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            if (e.Args.Length > 0)
            {
                var opArgs = new OctoPrintArgs();

                foreach (var arg in e.Args)
                {
                    var pair = arg.Split('=');

                    if (pair.Length != 2)
                    {
                        InvalidArgs();
                        return;
                    }

                    switch (pair[0])
                    {
                    case "-f":
                        var index = pair[1].LastIndexOf('\\');
                        opArgs.Path = pair[1].Substring(0, index);
                        opArgs.File = pair[1].Substring(index + 1);
                        break;

                    case "-s":
                        opArgs.Server = pair[1];
                        break;

                    case "-a":
                        opArgs.ApiKey = pair[1];
                        break;

                    default:
                        InvalidArgs();
                        return;
                    }
                }

                MainWindow wnd = new MainWindow(opArgs);

                wnd.Show();
            }
            else
            {
                InvalidArgs();
            }
        }