public MonitoredSystem(string name, int id, string mac, string fqdn, MappingState state, DateTime?resetDate, ExtendedObservableCollection <Plugin> plugins,
                               string platform, bool isAvailable, int ouID, DateTime?lastUpdate)
            : base(id, name, fqdn)
        {
            Intialize();
            this.MAC             = mac;
            this.State           = state;
            this.ResetDate       = resetDate;
            this.Plugins         = plugins;
            this.CurrentPlatform = platform;
            this.IsAvailable     = isAvailable;
            this.OuID            = ouID;
            this.LastUpdate      = lastUpdate;
            MonitoredSystemState ms = LayoutManager.Instance.GetMSState(id);

            if (ms == null)
            {
                var l = (from p in DataModel.Instance.LevelDefinitions
                         orderby p.Level ascending
                         select p.LevelID).First();
                LayoutManager.Instance.SetMSState(ID, l);
            }
            else
            {
                foreach (var p in ms.ShownPlugins)
                {
                    LayoutManager.Instance.SetMSState(ID, ms.Level, p, true);
                }
            }
        }
 /// <summary>
 /// Sets a given Monitored System to a defined State. This Method must be
 /// called each time a monitored system changes its visualisation state.
 /// </summary>
 /// <param name="ID">The ID of the MonitoredSystem from the Database. Make sure that this id is uniq.</param>
 /// <param name="state">The complete State of the visualisation of the Monitored System (level, opend plugins)</param>
 public void SetState(int ID, MonitoredSystemState state, bool sendFullLayout = false)
 {
     if (state != null)
     {
         stateMSs.Remove(ID);
         stateMSs.Add(ID, state);
         // fire event
         if (this.MonitoredSystemStateChanged != null)
         {
             this.MonitoredSystemStateChanged(ID, state, sendFullLayout);
         }
     }
 }
Exemple #3
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            MonitoredSystemState s = obj as MonitoredSystemState;

            if ((System.Object)s == null)
            {
                return(false);
            }

            return(Equals(s));
        }
Exemple #4
0
        void expander_Collapsed(object sender, RoutedEventArgs e)
        {
            ToggleButton ex = sender as ToggleButton;

            expander = ex;
            if (ex != null)
            {
                MonitoredSystem      ms    = (MonitoredSystem)ex.Tag;
                MonitoredSystemState state = LayoutManager.Instance.GetMSState(ms.ID);
                var ms_id      = ms.ID;
                var pluginName = (ex.FindName("PluginName") as TextBlock).Text;
                int level      = state.Level;
                if (ms_id >= 0 && level >= 0)
                {
                    if (state.ShownPlugins.Contains(pluginName))
                    {
                        LayoutManager.Instance.SetMSState(ms_id, level, pluginName, false, true);
                    }
                }
            }
        }
Exemple #5
0
        public bool Equals(MonitoredSystemState s)
        {
            if ((object)s == null)
            {
                return(false);
            }
            if (this.Level != s.Level)
            {
                return(false);
            }
            List <string> otherPlugins = s.ShownPlugins;

            foreach (var x in ShownPlugins)
            {
                if (!otherPlugins.Remove(x))
                {
                    return(false);
                }
            }
            return(otherPlugins.Count == 0);
        }
 public LayoutChangeCommand(int ID, MonitoredSystemState state)
 {
     CommandType = LayoutCommand.MS_STATE_CHANGED;
     this.ID     = ID;
     data        = state.ToString();
 }