public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { MonitoredSystem ms = null; string plugin_name = null; foreach (var o in values) { if ((o as MonitoredSystem) != null) { ms = o as MonitoredSystem; } if ((o as string) != null) { plugin_name = o as string; } //if ((o as int?) != null) //{ // Console.WriteLine("Sequence was " + o); //} } if (plugin_name == null || ms == null) { return(false); } MonitoredSystemState state = LayoutManager.Instance.GetMSState(ms.ID); return(state.ShownPlugins.Contains(plugin_name)); }
private void currentLayout_MonitoredSystemStateChanged(int ID, MonitoredSystemState state, bool sendFullLayout = false) { if (state != null) { if (MonitoredSystemStateChanged != null) { MonitoredSystemStateChanged(ID, state.Level, state.ShownPlugins.ToArray()); } if (ConfigClass.IsOperator) { SendLayoutChanges(new LayoutChangeCommand(ID, state), sendFullLayout); } } }
/// <summary> /// Sets the MonitoredSystemState of a MS with the ID in the current layout. /// </summary> /// <param name="ID">the MS id</param> /// <param name="Level">the level of the MS shown</param> /// <param name="plugin">specifies a plugin name to add as flipped to the MS</param> /// <param name="add">if add is false, then the defined plugin will be removed from the MonitoredSystemstate</param> public void SetMSState(int ID, int Level, string plugin = "", bool add = true, bool sendFullLayout = false) { MonitoredSystemState s = CurrentLayout.GetMSState(ID); if (s == null) { s = new MonitoredSystemState(); } s.Level = Level; if (plugin != "") { bool hasCustomUI; var currentLevel = (from p in DataModel.Instance.LevelDefinitions where p.LevelID == s.Level select p as LevelDefinition).FirstOrDefault(); if (currentLevel == null) { hasCustomUI = false; } else { hasCustomUI = currentLevel.UseCustomUI; } if (add) { if (s.ShownPlugins.Contains(plugin)) { s.HidePlugin(plugin); } s.ShowPlugin(plugin); } else { s.HidePlugin(plugin); } } CurrentLayout.SetState(ID, s, sendFullLayout); }