Beispiel #1
0
        public void CreateMenu()
        {
            AppCommand schedulerMenu = GetSchedulerMenu();

            AppCommand showCommand = new AppCommand("SuperSchedulerCreateSchedule", "Schedules");
            showCommand.Click += (sender, e) =>
            {
                using (SetupForm form = new SetupForm(_data))
                {
                    if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                    }
                }
            };

            LatchedAppCommand enabledCommand = new LatchedAppCommand("SuperSchedulerEnabled", "Enabled");
            enabledCommand.IsChecked = _data.IsEnabled;
            enabledCommand.Checked += (sender, e) =>
            {
                _data.IsEnabled = e.CheckedState;
            };

            /*if (schedulerMenu.Items.Length > 0)
                schedulerMenu.Add(new AppCommand("s1", "-"));*/
            schedulerMenu.Add(showCommand);
            schedulerMenu.Add(new AppCommand("s1", "-"));
            schedulerMenu.Add(enabledCommand);
        }
Beispiel #2
0
		private void _AddApplicationMenu()
		{
			if (_AppSupportsCommands()) {
				AppCommand schedulerMenu = _application.AppCommands.Find(MENU_ID_ROOT);
				if (schedulerMenu == null)
				{
					schedulerMenu = new AppCommand(MENU_ID_ROOT, MENU_ID_NAME);
					_application.AppCommands.Add(schedulerMenu);
				} 

				AppCommand rootCommand = new AppCommand("ShowEditor", "Show Editor...");
				rootCommand.Click += (sender, e) =>
				{
					using (ShowListForm form = new ShowListForm(_data))
					{
						if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
						{
						}
					}
				};
				if (schedulerMenu.Items.Length > 0)
					schedulerMenu.Add(new AppCommand("s1", "-"));
				schedulerMenu.Add(rootCommand);
			}
		}
Beispiel #3
0
        public VixenApplication()
        {
            InitializeComponent();
            Icon = Resources.Icon_Vixen3;

            string[] args = Environment.GetCommandLineArgs();
            foreach (string arg in args) {
                _ProcessArg(arg);
            }

            if (_rootDataDirectory == null)
                ProcessProfiles();

            _applicationData = new VixenApplicationData(_rootDataDirectory);

            stopping = false;
            PopulateVersionStrings();
            AppCommands = new AppCommand(this);
            Execution.ExecutionStateChanged += executionStateChangedHandler;
            VixenSystem.Start(this, _openExecution, _disableControllers, _applicationData.DataFileDirectory);

            InitStats();

            // other modules look for and create it this way...
            AppCommand toolsMenu = AppCommands.Find("Tools");
            if (toolsMenu == null)
            {
                toolsMenu = new AppCommand("Tools", "Tools");
                AppCommands.Add(toolsMenu);
            }
            var myMenu = new AppCommand("Options", "Options...");
            myMenu.Click += optionsToolStripMenuItem_Click;
            toolsMenu.Add(myMenu);
        }
 private AppCommand _GetToolsMenu()
 {
     AppCommand toolsMenu = _application.AppCommands.Find("Tools");
     if(toolsMenu == null) {
         toolsMenu = new AppCommand("Tools", "Tools");
         _application.AppCommands.Add(toolsMenu);
     }
     return toolsMenu;
 }
Beispiel #5
0
 public void Add(AppCommand appCommand)
 {
     appCommand.Parent = this;
     _items.Add(appCommand);
     (_toolStripItem as ToolStripMenuItem).DropDownItems.Add(appCommand.Item);
     if (_rootControl != null)
     {
         _AddToRoot(appCommand);
     }
 }
Beispiel #6
0
 public AppCommand GetSchedulerMenu()
 {
     AppCommand menu = _application.AppCommands.Find(MENU_ID_ROOT);
     if (menu == null)
     {
         menu = new AppCommand(MENU_ID_ROOT, MENU_ID_NAME);
         _application.AppCommands.Add(menu);
     }
     return menu;
 }
Beispiel #7
0
		private void _AddApplicationMenu()
		{
			if (_AppSupportsCommands())
			{
				AppCommand toolsMenu = _GetToolsMenu();
				AppCommand rootCommand = new AppCommand(MENU_ID_ROOT, "Web Server");

				rootCommand.Add(_showCommand ?? (_showCommand = _CreateShowCommand()));

				toolsMenu.Add(rootCommand);
			}
		}
Beispiel #8
0
		public VixenApplication()
		{
			InitializeComponent();
			labelVersion.Font = new Font("Segoe UI", 14);
			labelDebugVersion.Font = new Font("Segoe UI", 9);
			//Get rid of the ugly grip that we dont want to show anyway. 
			//Workaround for a MS bug
			statusStrip.Padding = new Padding(statusStrip.Padding.Left,
			statusStrip.Padding.Top, statusStrip.Padding.Left, statusStrip.Padding.Bottom);
			statusStrip.Font = SystemFonts.StatusFont;

			Icon = Resources.Icon_Vixen3;
			ForeColor = ThemeColorTable.ForeColor;
			BackColor = ThemeColorTable.BackgroundColor;
			ThemeUpdateControls.UpdateControls(this);
			statusStrip.BackColor = ThemeColorTable.BackgroundColor;
			statusStrip.ForeColor = ThemeColorTable.ForeColor;
			toolStripStatusLabel1.ForeColor = ThemeColorTable.ForeColor;
			toolStripStatusLabelExecutionLight.ForeColor = ThemeColorTable.ForeColor;
			toolStripStatusLabelExecutionState.ForeColor = ThemeColorTable.ForeColor;
			toolStripStatusLabel_memory.ForeColor = ThemeColorTable.ForeColor;

			string[] args = Environment.GetCommandLineArgs();
			foreach (string arg in args) {
				_ProcessArg(arg);
			}

			StartJITProfiler();

			if (_rootDataDirectory == null)
				ProcessProfiles();

			_applicationData = new VixenApplicationData(_rootDataDirectory);

			stopping = false;
			PopulateVersionStrings();
			AppCommands = new AppCommand(this);
			Execution.ExecutionStateChanged += executionStateChangedHandler;
			VixenSystem.Start(this, _openExecution, _disableControllers, _applicationData.DataFileDirectory);

			InitStats();

			// other modules look for and create it this way...
			AppCommand toolsMenu = AppCommands.Find("Tools");
			if (toolsMenu == null)
			{
				toolsMenu = new AppCommand("Tools", "Tools");
				AppCommands.Add(toolsMenu);
		}
			var myMenu = new AppCommand("Options", "Options...");
			myMenu.Click += optionsToolStripMenuItem_Click;
			toolsMenu.Add(myMenu);
		}
Beispiel #9
0
        private void _AddApplicationMenu()
        {
            if (_AppSupportsCommands())
            {
                var toolsMenu = _GetToolsMenu();
                var rootCommand = new AppCommand(MENU_ID_ROOT, "Version Control");
                rootCommand.Add(_enabledCommand ?? (_enabledCommand = _CreateEnabledCommand()));
                rootCommand.Add(new AppCommand("s1", "-"));
                rootCommand.Add(_showCommand ?? (_showCommand = _CreateShowCommand()));

                toolsMenu.Add(rootCommand);
            }
        }
Beispiel #10
0
        public void Remove(string appCommandName)
        {
            AppCommand appCommand = _items.FirstOrDefault(x => x.Name == appCommandName);

            if (appCommand != null)
            {
                appCommand.Parent = null;
                _items.Remove(appCommand);
                (_toolStripItem as ToolStripMenuItem).DropDownItems.Remove(appCommand.Item);
                if (_rootControl != null)
                {
                    _RemoveFromRoot(appCommand);
                }
            }
        }
Beispiel #11
0
		private void _AddMenu()
		{
			if (_application != null
			    && _application.AppCommands != null) {
				AppCommand toolsMenu = _application.AppCommands.Find("Tools");
				if (toolsMenu == null)
				{
					toolsMenu = new AppCommand("Tools", "Tools");
					_application.AppCommands.Add(toolsMenu);
				}
				var myMenu = new AppCommand(ID_MENU, "Instrumentation...");
				myMenu.Click += OnMainMenuOnClick;
				toolsMenu.Add(myMenu);
			}
		}
        public override void Loading()
        {
            if(_AppSupportsCommands) {
                AppCommand toolsMenu = _GetToolsMenu();

                AppCommand rootMenuItem = new AppCommand(ROOT_ID, "Input Effect Router");
                rootMenuItem.Click += (sender, e) => {
                    if(_inputManagement.ShowForm() == DialogResult.OK) {
                        _data.Map = _inputManagement.InputEffects;
                        _data.InputModules = _inputManagement.InputModules;
                    }
                };

                toolsMenu.Add(rootMenuItem);

                _inputManagement.Start();
            }
        }
Beispiel #13
0
 public void Add(AppCommand appCommand)
 {
     if (MainWindow.InvokeRequired)
     {
         var d = new SafeCallDelegate <AppCommand>(Add);
         MainWindow.Invoke(d, appCommand);
     }
     else
     {
         appCommand.Parent = this;
         _items.Add(appCommand);
         (_toolStripItem as ToolStripMenuItem).DropDownItems.Add(appCommand.Item);
         if (_rootControl != null)
         {
             _AddToRoot(appCommand);
         }
     }
 }
        public VixenApplication()
        {
            string[] args = Environment.GetCommandLineArgs();
            foreach(string arg in args) {
                _ProcessArg(arg);
            }

            _applicationData = new VixenApplicationData(_rootDataDirectory);

            stopping = false;
            InitializeComponent();
            labelVersion.Text = "[" + _GetVersionString(VixenSystem.AssemblyFileName) + "]";
            AppCommands = new AppCommand(this);
            Execution.ExecutionStateChanged += executionStateChangedHandler;
            VixenSystem.Start(this, _openExecution, _disableControllers, _applicationData.DataFileDirectory);

            InitStats();
        }
Beispiel #15
0
 public void Remove(string appCommandName)
 {
     if (MainWindow.InvokeRequired)
     {
         var d = new SafeCallDelegate <string>(Remove);
         MainWindow.Invoke(d, appCommandName);
     }
     else
     {
         AppCommand appCommand = _items.FirstOrDefault(x => x.Name == appCommandName);
         if (appCommand != null)
         {
             appCommand.Parent = null;
             _items.Remove(appCommand);
             (_toolStripItem as ToolStripMenuItem).DropDownItems.Remove(appCommand.Item);
             if (_rootControl != null)
             {
                 _RemoveFromRoot(appCommand);
             }
         }
     }
 }
Beispiel #16
0
        private void _RemoveFromRoot(AppCommand appCommand)
        {
            if (MainWindow.InvokeRequired)
            {
                var d = new SafeCallDelegate <AppCommand>(_RemoveFromRoot);
                MainWindow.Invoke(d, appCommand);
            }
            else
            {
                if (_rootControl != null)
                {
                    switch (appCommand.Style)
                    {
                    case AppCommandStyle.Context:
                        // Control, as-is
                        // Don't do anything.
                        break;

                    case AppCommandStyle.Menu:
                        // MenuStrip child control
                        if (_rootControl is Form)
                        {
                            MenuStrip menuStrip = (_rootControl as Form).MainMenuStrip;
                            if (menuStrip != null)
                            {
                                menuStrip.Items.Remove(appCommand.Item);
                            }
                        }
                        else if (_rootControl is MenuStrip)
                        {
                            (_rootControl as MenuStrip).Items.Remove(appCommand.Item);
                        }
                        break;
                    }
                }
            }
        }
Beispiel #17
0
        public AppCommand Find(string relativePath)
        {
            // If there is nothing left in the path, we've arrived at the destination.
            if (string.IsNullOrEmpty(relativePath))
            {
                return(this);
            }

            // Split the remaining path into two parts -- next node and remainder.
            string childName;
            string pathRemaining;
            int    index = relativePath.IndexOf(PathDelimiter);

            if (index != -1)
            {
                childName     = relativePath.Substring(0, index);
                pathRemaining = relativePath.Substring(index + 1);
            }
            else
            {
                childName     = relativePath;
                pathRemaining = string.Empty;
            }

            AppCommand appCommand = _items.Find(x => x.Name == childName);

            if (appCommand != null)
            {
                // Found the child, continue the traversal.
                return(appCommand.Find(pathRemaining));
            }
            else
            {
                // Child not found, invalid path.
                return(null);
            }
        }
        private void _AddApplicationMenu()
        {
            if(_AppSupportsCommands()) {
                AppCommand rootCommand = new AppCommand(ID_ROOT, "Scheduler");

                LatchedAppCommand enabledCommand = new LatchedAppCommand("SchedulerEnabled", "Enabled");
                enabledCommand.IsChecked = _data.IsEnabled;
                enabledCommand.Checked += (sender, e) => {
                    // Not setting the data member in _SetEnableState because we want to be
                    // able to call _SetEnableState without affecting the data (to stop
                    // the scheduler upon shutdown).
                    _data.IsEnabled = e.CheckedState;
                    _SetEnableState(_data.IsEnabled);
                };

                AppCommand separator1 = new AppCommand("s1", "-");

                AppCommand showCommand = new AppCommand("SchedulerShow", "Show");
                showCommand.Click += (sender, e) => {
                    using(SchedulerForm schedulerForm = new SchedulerForm(_data)) {
                        if(schedulerForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
                            enabledCommand.IsChecked = _data.IsEnabled;
                        }
                    }
                };

                rootCommand.Add(enabledCommand);
                rootCommand.Add(separator1);
                rootCommand.Add(showCommand);

                _application.AppCommands.Add(rootCommand);
            }
        }
        private void InjectAppCommands()
        {
            if (_application == null
                || _application.AppCommands == null)
            {
                return;
            }

            var rootCommand = new AppCommand("Setup Preview Module", "Display Preview")
                              {
                                  Enabled = true,
                                  Visible = true,
                                  Style = AppCommand.AppCommandStyle.Menu
                              };
            var command = new AppCommand("Edit Preview Setup", "Edit Preview Setup");
            command.Click += SetupAppCommandClick;
            command.Enabled = true;
            command.Visible = true;
            rootCommand.Add(command);
            command = new AppCommand("Preferences window", "Preferences");
            command.Click += PreferencesCommandClick;
            command.Enabled = true;
            command.Visible = true;
            rootCommand.Add(command);
            _application.AppCommands.Add(rootCommand);
        }
Beispiel #20
0
 private void _RemoveFromRoot(AppCommand appCommand)
 {
     if (_rootControl != null) {
         switch (appCommand.Style) {
             case AppCommandStyle.Context:
                 // Control, as-is
                 // Don't do anything.
                 break;
             case AppCommandStyle.Menu:
                 // MenuStrip child control
                 if (_rootControl is Form) {
                     MenuStrip menuStrip = (_rootControl as Form).MainMenuStrip;
                     if (menuStrip != null) {
                         menuStrip.Items.Remove(appCommand.Item);
                     }
                 }
                 else if (_rootControl is MenuStrip) {
                     (_rootControl as MenuStrip).Items.Remove(appCommand.Item);
                 }
                 break;
         }
     }
 }
Beispiel #21
0
 private void _AddToRoot(AppCommand appCommand)
 {
     if (_rootControl != null) {
         switch (appCommand.Style) {
             case AppCommandStyle.Context:
                 // Control, as-is
                 // Don't do anything.  Not going to create a context menu and parent it.
                 break;
             case AppCommandStyle.Menu:
                 // MenuStrip child control
                 if (_rootControl is Form) {
                     MenuStrip menuStrip = (_rootControl as Form).MainMenuStrip;
                     if (menuStrip != null) {
                         menuStrip.Items.Add(appCommand.Item);
                     }
                 }
                 else if (_rootControl is MenuStrip) {
                     (_rootControl as MenuStrip).Items.Add(appCommand.Item);
                 }
                 break;
         }
     }
 }
Beispiel #22
0
 public void Add(AppCommand appCommand)
 {
     appCommand.Parent = this;
     _items.Add(appCommand);
     (_toolStripItem as ToolStripMenuItem).DropDownItems.Add(appCommand.Item);
     if (_rootControl != null) {
         _AddToRoot(appCommand);
     }
 }
Beispiel #23
0
        private AppCommand _CreateShowCommand()
        {
            AppCommand showCommand = new AppCommand("VersionControl", "Browse");
            showCommand.Click += (sender, e) =>
            {
                using (Versioning cs = new Versioning((Data)StaticModuleData, repo))
                {

                    if (cs.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {

                    }
                }
            };

            return showCommand;
        }
Beispiel #24
0
        private AppCommand _CreateShowCommand()
        {
            AppCommand showCommand = new AppCommand("WebserverConfigure", "Configure");
            showCommand.Click += (sender, e) => {
                using (Settings cs = new Settings(_data)) {
                    cs.SettingsChanged += cs_SettingsChanged;
                    if (cs.ShowDialog() == System.Windows.Forms.DialogResult.OK) {

                        _data.HttpPort = cs.Port;
                        _data.IsEnabled = cs.WebServerEnabled;

                    }
                    _SetServerEnableState(_data.IsEnabled, _data.HttpPort);
                }
            };

            return showCommand;
        }
        private void _AddApplicationMenu()
        {
            if(_AppSupportsCommands()) {
                AppCommand toolsMenu = _GetToolsMenu();
                AppCommand rootCommand = new AppCommand(MENU_ID_ROOT, "Simple Scheduler");

                rootCommand.Add(_enabledCommand ?? (_enabledCommand = _CreateEnabledCommand()));
                rootCommand.Add(new AppCommand("s1", "-"));
                rootCommand.Add(_showCommand ?? (_showCommand = _CreateShowCommand()));

                toolsMenu.Add(rootCommand);
            }
        }
        private AppCommand _CreateShowCommand()
        {
            AppCommand showCommand = new AppCommand("SimpleSchedulerShow", "Show");
            showCommand.Click += (sender, e) => {
                using(ConfigureSchedule cs = new ConfigureSchedule(_data)) {
                    if(cs.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
                        _enabledCommand.IsChecked = _data.IsEnabled;
                        _Timer.Enabled = false;
                        _stateMachine.Refresh(_data.ScheduledItems);
                        _Timer.Enabled = _data.IsEnabled;
                    }
                }
            };

            return showCommand;
        }
Beispiel #27
0
        private void _AddApplicationMenu()
        {
            if (_AppSupportsCommands())
            {
                AppCommand toolsMenu = _GetToolsMenu();
                AppCommand showCommand = new AppCommand(MENU_ID_ROOT, "Web Server");

                showCommand.Click += (sender, e) =>
                {
                    using (Settings cs = new Settings(_data))
                    {
                        cs.SettingsChanged += cs_SettingsChanged;
                        if (cs.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {

                            _data.HttpPort = cs.Port;
                            _data.IsEnabled = cs.WebServerEnabled;

                        }
                        _SetServerEnableState(_data.IsEnabled, _data.HttpPort);
                    }
                };

                toolsMenu.Add(showCommand);
            }
        }
Beispiel #28
0
        public VixenApplication()
        {
            InitializeComponent();
            labelVersion.Font = new Font("Segoe UI", 14);
            //Get rid of the ugly grip that we dont want to show anyway.
            //Workaround for a MS bug
            statusStrip.Padding = new Padding(statusStrip.Padding.Left,
            statusStrip.Padding.Top, statusStrip.Padding.Left, statusStrip.Padding.Bottom);
            statusStrip.Font = SystemFonts.StatusFont;

            Icon = Resources.Icon_Vixen3;
            ForeColor = ThemeColorTable.ForeColor;
            BackColor = ThemeColorTable.BackgroundColor;
            ThemeUpdateControls.UpdateControls(this);
            statusStrip.BackColor = ThemeColorTable.BackgroundColor;
            statusStrip.ForeColor = ThemeColorTable.ForeColor;
            toolStripStatusLabel1.ForeColor = ThemeColorTable.ForeColor;
            toolStripStatusLabelExecutionLight.ForeColor = ThemeColorTable.ForeColor;
            toolStripStatusLabelExecutionState.ForeColor = ThemeColorTable.ForeColor;
            toolStripStatusLabel_memory.ForeColor = ThemeColorTable.ForeColor;
            contextMenuStripRecent.Renderer = new ThemeToolStripRenderer();

            string[] args = Environment.GetCommandLineArgs();
            foreach (string arg in args) {
                _ProcessArg(arg);
            }

            StartJITProfiler();

            if (_rootDataDirectory == null)
            {
                ProcessProfiles();
            }

            _applicationData = new VixenApplicationData(_rootDataDirectory);

            _rootDataDirectory = _applicationData.DataFileDirectory;

            if (!CreateLockFile())
            {
                var form = new MessageBoxForm("Profile is already in use or unable to the lock the profile.","Error",MessageBoxButtons.OK, SystemIcons.Error);
                form.ShowDialog();
                form.Dispose();
                Environment.Exit(0);
            }

            stopping = false;
            PopulateVersionStrings();
            AppCommands = new AppCommand(this);
            Execution.ExecutionStateChanged += executionStateChangedHandler;
            VixenSystem.Start(this, _openExecution, _disableControllers, _applicationData.DataFileDirectory);

            InitStats();

            // other modules look for and create it this way...
            AppCommand toolsMenu = AppCommands.Find("Tools");
            if (toolsMenu == null)
            {
                toolsMenu = new AppCommand("Tools", "Tools");
                AppCommands.Add(toolsMenu);
            }
            var myMenu = new AppCommand("Options", "Options...");
            myMenu.Click += optionsToolStripMenuItem_Click;
            toolsMenu.Add(myMenu);

            toolStripItemClearSequences.Click += (mySender, myE) => ClearRecentSequencesList();
        }