public void AddMonitor(TextureHolderBase textureHolderBase)
        {
            var go = GameObject.Instantiate(prefab) as GameObject;

            go.transform.SetParent(contentSizeFitter.transform, false);
            var component = go.GetComponent <MonitorView>();

            component.Init(textureHolderBase.gameObject.name, textureHolderBase, gridLayoutGroup.cellSize);
            component.ClickEvent += OnSelected;
            MonitorViews.Add(component);
        }
예제 #2
0
        public DesignTimeProjectView()
        {
            Title = "Design Time Project View";
            AddFacettePerspectives(
                nameof(CommandAction.Host),
                nameof(CommandAction.Service),
                nameof(CommandAction.Verb),
                "Environment",
                "Role");
            ActionViews.Add(new ActionView
            {
                Title     = "Start X on A",
                Command   = "start_x",
                Arguments = "--on a",
                Facettes  = new Dictionary <string, string>
                {
                    { "Verb", "start" },
                    { "Service", "x" },
                    { "Host", "a" },
                }
            });
            ActionViews.Add(new ActionView
            {
                Title     = "Stop X on A",
                Command   = "stop_x",
                Arguments = "--on a",
                Facettes  = new Dictionary <string, string>
                {
                    { "Verb", "stop" },
                    { "Service", "x" },
                    { "Host", "a" },
                }
            });
            ActionViews.Add(new ActionView
            {
                Title     = "Start Y on A",
                Command   = "start_y",
                Arguments = "--on a",
                Facettes  = new Dictionary <string, string>
                {
                    { "Verb", "start" },
                    { "Service", "y" },
                    { "Host", "a" },
                }
            });
            ActionViews.Add(new ActionView
            {
                Title     = "Stop Y on A",
                Command   = "stop_y",
                Arguments = "--on a",
                Facettes  = new Dictionary <string, string>
                {
                    { "Verb", "stop" },
                    { "Service", "y" },
                    { "Host", "a" },
                }
            });
            CurrentPerspective = Perspectives[0];
            CurrentPerspective.CurrentSubset = CurrentPerspective.Subsets[0];

            MonitorViews.Add(new CommandMonitorView
            {
                Title     = "Monitor A",
                Command   = "xcopy",
                Arguments = "/?",
                Interval  = new TimeSpan(0, 0, 4),
                HasLastExecutionResult = true,
                LastExecutionResult    = true,
                LastExecutionTime      = DateTime.Now,
            });
            MonitorViews.Add(new CommandMonitorView
            {
                Title     = "Monitor B",
                Command   = "git",
                Arguments = "--version",
                Interval  = new TimeSpan(0, 0, 4),
                HasLastExecutionResult    = true,
                LastExecutionResult       = false,
                HasExecutionResultChanged = true,
                LastExecutionTime         = DateTime.Now - TimeSpan.FromSeconds(10),
            });
            MonitorViews.Add(new CommandMonitorView
            {
                Title   = "Very long monitor name with a lots of characters",
                Command = "invalid",
                HasLastExecutionResult = false,
                LastExecutionResult    = false,
            });
        }