//Starts DMX Lightscene public void StartLightscene(string lightscene) { bool fired = false; for (int i = 0; i < ConnectionManager.getInstance().GuiSession.SceneLists.Count; i++) { if (lightscene == ConnectionManager.getInstance().GuiSession.SceneLists[i].Name) { try { var sceneListState = ConnectionManager.getInstance().GuiSession.SceneLists[i].State; if (sceneListState.ToString().Equals("RUNNING")) { ConnectionManager.getInstance().GuiSession.SceneLists[i].stop(); //ConnectionManager.getInstance().GuiSession.SceneLists[i].play(); } ConnectionManager.getInstance().GuiSession.SceneLists[i].go(); fired = true; } catch { Log.LogWrite("Couldn't start lightscene: " + lightscene); } } } if (fired == false) { Log.LogWrite("Couldn't find following lightscene in current project: " + lightscene); } }
private void OnTimedEvent(object source, EventArgs e, string lightscene) { Communicator myCommunicator = new Communicator(); try { myCommunicator.StartLightscene(lightscene); } catch (Exception ex) { Log.LogWrite("Couldn't start lightscene: " + lightscene); } }
public SchedulerForm() { Log.LogWrite("Test Log...."); InitializeComponent(); //Define in which Menu the window will be displayed this.MainFormMenu = MenuType.Windows; //Defining TabText for DMX Control Plugin this.TabText = "Scheduler Plug In"; AppointmentList.Instance.changed += Instance_changed; //Setting for "autorun" of Scheduler on start-up: Get value of Scheduler_chkbox IsRunning marked on last session try { IsRunning = SettingsManager.getInstance().getGuiSetting <bool>("SchedulerAutoRun.SETTING"); chkbox_isSchedulerRunning.Checked = IsRunning; } catch (Exception e) { Log.LogWrite("Couln't load SchedulerAutoRun.SETTING"); try { SettingsManager.getInstance().setGuiSetting("SchedulerAutoRun.SETTING", false); Log.LogWrite("Couln't load SchedulerAutoRun.SETTING, AutoRun is now set to false"); }catch (Exception ex) { Log.LogWrite("Couldn't set SchedulerAutoRun.SETTING"); } } //AutoLoad of last edited AppointmentList (which was saved as XML-File) try { LastEditedFilePath = SettingsManager.getInstance().getGuiSetting <string>("LastEditedFilePath.SETTING"); AppointmentList.Instance.LoadAppointmentsFromXml(LastEditedFilePath); } catch (Exception e) { Log.LogWrite("Couldn't load XML-File"); try { string m_exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); StringBuilder sb = new StringBuilder(m_exePath); sb.Append(@"\default.xml"); string xml_path = sb.ToString(); //AppointmentList.Instance.SaveAppointmentList2Xml(m_exePath, "default.xml"); AppointmentList.Instance.SaveAppointmentList2Xml(xml_path); SettingsManager.getInstance().setGuiSetting("LastEditedFilePath.SETTING", xml_path); Log.LogWrite("Couldn't load XML file, default XML-File was created in GUI Plug-In folder"); } catch (Exception ex) { Log.LogWrite("Couldn't create default XML-File in GUI Plug-In folder"); } } // AutoStart EventWatchdog if Setting IsRunning is true if (IsRunning) { SchedulerTimer.EventWatchdog.Instance.StartWatchDog(); } else { //SchedulerTimer.EventWatchdog.Instance.StopWatchdog(); } }