예제 #1
0
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
        public AppTreeRenderer(ImGuiWindow wnd, IDirig ctrl)
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
        {
            _wnd      = wnd;
            _ctrl     = ctrl;
            _treeRend = new FolderTreeRenderer(_wnd, ctrl, RenderNode);
            Reset();
        }
예제 #2
0
        public ScriptRenderer(ImGuiWindow wnd, string id, IDirig ctrl)
        {
            _wnd  = wnd;
            _id   = id;
            _ctrl = ctrl;

            _txStart = _wnd.GetImage("Resources/play.png");
            _txKill  = _wnd.GetImage("Resources/delete.png");
        }
예제 #3
0
        public FolderWatcher(System.Xml.Linq.XElement rootXml, IDirig ctrl, string rootForRelativePaths)
        {
            this._ctrl              = ctrl;
            this._conditions        = X.getStringAttr(rootXml, "Conditions");
            this._relativePathsRoot = rootForRelativePaths;

            if (String.IsNullOrEmpty(rootForRelativePaths))
            {
                _relativePathsRoot = System.IO.Directory.GetCurrentDirectory();
            }
            else
            {
                _relativePathsRoot = rootForRelativePaths;
            }

            var inclSubdirs = X.getBoolAttr(rootXml, "IncludeSubdirs");
            var path        = X.getStringAttr(rootXml, "Path");
            var filter      = X.getStringAttr(rootXml, "Filter");

            if (String.IsNullOrEmpty(path))
            {
                log.Error("Path not defined or empty!");
                return;
            }

            var absPath = BuildAbsolutePath(path);

            if (!System.IO.Directory.Exists(absPath))
            {
                log.Error($"Path '{absPath}' does not exist! FolderWatcher not installed.");
                return;
            }

            _watcher.Path = absPath;
            _watcher.IncludeSubdirectories = inclSubdirs;

            if (!String.IsNullOrEmpty(filter))
            {
                _watcher.Filter = filter;
            }

            if (_conditions == "NewFile")
            {
                _watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.CreationTime | NotifyFilters.LastWrite;
                _watcher.Created     += new FileSystemEventHandler(OnFileCreated);
            }

            foreach (var actXml in rootXml.Descendants("Action"))
            {
                _actionXmls.Add(actXml);
            }

            log.DebugFormat("FolderWatcher initialized. Path={0}, Filter={1}, Conditions={2}", _watcher.Path, _watcher.Filter, _conditions);
            Initialized = true;

            _watcher.EnableRaisingEvents = true;
        }
예제 #4
0
파일: Tools.cs 프로젝트: pjanec/dirigent
        public static bool IsAppInPlan(IDirig iDirig, AppIdTuple appId, string?planId)
        {
            if (planId is null)
            {
                return(false);
            }
            var planDef = iDirig.GetPlanDef(planId);

            return(IsAppInPlan(iDirig, appId, planDef));
        }
예제 #5
0
파일: Tools.cs 프로젝트: pjanec/dirigent
        public static bool IsAppInPlan(IDirig iDirig, AppIdTuple appId, PlanDef?planDef)
        {
            if (planDef is null)
            {
                return(false);                              // the plan does not exists
            }
            var appDef = planDef.AppDefs.Find(x => x.Id == appId);

            return(appDef is not null);            // app is part of the plan
        }
예제 #6
0
파일: GuiApp.cs 프로젝트: pjanec/dirigent
        public GuiApp(AppConfig ac)
        {
            _ac = ac;
            log.Debug($"Running with masterIp={_ac.MasterIP}, masterPort={_ac.MasterPort}");

            _wnd           = new ImGuiWindow("Dirigent Gui", width: 400, height: 650);
            _wnd.OnDrawUI += DrawUI;

            _guiWin = new GuiWindow(_wnd, _ac);
            _ctrl   = _guiWin.Ctrl;
        }
예제 #7
0
        //private System.Numerics.Vector2 _btnSize;

        public AppRenderer(ImGuiWindow wnd, string uniqueUiId, AppIdTuple id, IDirig ctrl, AppDef?appDef = null)
        {
            _wnd        = wnd;
            _id         = id;
            _ctrl       = ctrl;
            _appDef     = appDef;
            _uniqueUiId = uniqueUiId;

            //_btnSize = ImGui.CalcTextSize("XX")*1.4f;
            _txStart   = _wnd.GetImage("Resources/play.png");
            _txKill    = _wnd.GetImage("Resources/delete.png");
            _txRestart = _wnd.GetImage("Resources/refresh.png");
        }
예제 #8
0
 public FolderTreeRenderer(ImGuiWindow wnd, IDirig ctrl, NodeDrawDelegate?nodeDrawDeleg)
 {
     _wnd           = wnd;
     _ctrl          = ctrl;
     _nodeDrawDeleg = nodeDrawDeleg ?? DefaultNodeDraw;
 }
예제 #9
0
 public ClientRenderer(ImGuiWindow wnd, string id, IDirig ctrl)
 {
     _wnd  = wnd;
     _id   = id;
     _ctrl = ctrl;
 }
예제 #10
0
파일: MainForm.cs 프로젝트: pjanec/dirigent
        public frmMain(
            AppConfig ac,
            NotifyIcon notifyIcon,
            string machineId             // empty if no local agent was started with the GUI
            )
        {
            _ac          = ac;
            _machineId   = machineId;           // FIXME: this is only valid if we are running a local agent! How do we know??
            _clientIdent = new Net.ClientIdent()
            {
                Sender = Guid.NewGuid().ToString(), SubscribedTo = Net.EMsgRecipCateg.Gui
            };
            _notifyIcon = notifyIcon;
            _allowLocalIfDisconnected = true;

            log.Debug($"Running with masterIp={_ac.MasterIP}, masterPort={_ac.MasterPort}");


            InitializeComponent();

            if (Common.Properties.Settings.Default.GridRowSpacing > 0)
            {
                this.gridPlans.RowTemplate.Height = Common.Properties.Settings.Default.GridRowSpacing;
                this.gridApps.RowTemplate.Height  = Common.Properties.Settings.Default.GridRowSpacing;
            }

            if (Common.Properties.Settings.Default.GridButtonSpacing > 0)
            {
                this.hdrPlanStart.Width   = Common.Properties.Settings.Default.GridButtonSpacing;
                this.hdrPlanStop.Width    = Common.Properties.Settings.Default.GridButtonSpacing;
                this.hdrPlanKill.Width    = Common.Properties.Settings.Default.GridButtonSpacing;
                this.hdrPlanRestart.Width = Common.Properties.Settings.Default.GridButtonSpacing;
                this.hdrKillIcon.Width    = Common.Properties.Settings.Default.GridButtonSpacing;
                this.hdrLaunchIcon.Width  = Common.Properties.Settings.Default.GridButtonSpacing;
                this.hdrRestartIcon.Width = Common.Properties.Settings.Default.GridButtonSpacing;
            }


            registerHotKeys();

            //setDoubleBuffered(gridApps, true); // not needed anymore, DataViewGrid does not flicker

            _planRepo = new List <PlanDef>();

            _client = new Net.Client(_clientIdent, ac.MasterIP, ac.MasterPort, autoConn: true);
            _client.MessageReceived += OnMessage;
            _reflStates              = new ReflectedStateRepo(_client);

            bool firstGotPlans = true;

            _reflStates.OnPlansReceived += () =>
            {
                if (firstGotPlans)
                {
                    selectPlan(ac.StartupPlan);
                }
                firstGotPlans = false;

                // udate current plan reference in case the plan def has changed
                if (_currentPlan is not null)
                {
                    _currentPlan = _reflStates.GetPlanDef(_currentPlan.Name);
                }
            };

            _ctrl = _reflStates;

            // start ticking
            log.DebugFormat("MainForm's timer period: {0}", ac.TickPeriod);
            tmrTick.Interval = ac.TickPeriod;
            tmrTick.Enabled  = true;
        }
예제 #11
0
 public GuiWinMenuRenderer(ImGuiWindow wnd, IDirig ctrl)
 {
     _wnd  = wnd;
     _ctrl = ctrl;
 }