Beispiel #1
0
        public void ComponentUpdated(ComponentMetadata component)
        {
            this.BeginInvoke(() =>
            {
                var oldComponent = Components.Where(c => c.OriginalObject.ComponentId == component.ComponentId).FirstOrDefault();

                if (oldComponent != null)
                {
                    oldComponent.UpdateFrom(component);
                }
                else
                {
                    ComponentMetadataModel model = new ComponentMetadataModel();
                    model.UpdateFrom(component);
                    model.StopCommand.ParameterizedExecuteCallback    += ExecuteStopCommand;
                    model.StartCommand.ParameterizedExecuteCallback   += ExecuteStartCommand;
                    model.RestartCommand.ParameterizedExecuteCallback += ExecuteRestartCommand;
                    model.DisableCommand.ParameterizedExecuteCallback += ExecuteDisableCommand;
                    Components.Add(model);
                }
            });
        }
Beispiel #2
0
        protected override void OnConnect(ISubscription source)
        {
            try
            {
                var infos = Channel.GetComponents();


                var startIcon   = WPFHelpers.GetImage("images/media-play.png");
                var stopIcon    = WPFHelpers.GetImage("images/media-stop.png");
                var restartIcon = WPFHelpers.GetImage("images/reload.png");
                var disableIcon = WPFHelpers.GetImage("images/ban.png");

                foreach (var info in infos)
                {
                    this.BeginInvoke(() =>
                    {
                        ComponentMetadataModel model = new ComponentMetadataModel();
                        model.UpdateFrom(info);
                        model.StopCommand.ParameterizedExecuteCallback    += ExecuteStopCommand;
                        model.StartCommand.ParameterizedExecuteCallback   += ExecuteStartCommand;
                        model.RestartCommand.ParameterizedExecuteCallback += ExecuteRestartCommand;
                        model.DisableCommand.ParameterizedExecuteCallback += ExecuteDisableCommand;
                        model.StartIcon   = startIcon;
                        model.StopIcon    = stopIcon;
                        model.RestartIcon = restartIcon;
                        model.DisableIcon = disableIcon;
                        Components.Add(model);
                    });
                }
            }
            catch
            {
                //nom nom nom
            }

            base.OnConnect(source);
        }