Exemple #1
0
        public App()
        {
            bool createdNew = true;

            mutex = new Mutex(true, "Dashboard", out createdNew);

            if (createdNew)
            {
                if (Environment.GetCommandLineArgs().Length > 1)
                {
                    foreach (string arg in Environment.GetCommandLineArgs())
                    {
                        if (string.Compare(arg, "Operator", true) == 0 ||
                            string.Compare(arg, "Supervisor", true) == 0 ||
                            string.Compare(arg, "Maintenance", true) == 0 ||
                            string.Compare(arg, "Engineer", true) == 0)
                        {
                            ConfigurationManager.AppSettings["SystemOperationMode"] = arg;
                            break;
                        }
                    }

                    EventLoggerAccess logger = new EventLoggerAccess();
                    _UIManager = new UIManager(logger);
                    _DataAccess = new DataAccess(logger);
                    _AssemblyManager = new AssemblyManager(_UIManager, _DataAccess, logger);

                    _DataAccess.StartUp();
                    _UIManager.Show();
                    logger.LogInfo("Dashboard Client Started");
                }
                else
                {
                    Application.Current.Shutdown();
                }
            }
            else
            {
                Process current = Process.GetCurrentProcess();
                foreach (Process process in Process.GetProcessesByName(current.ProcessName))
                {
                    SetForegroundWindow(process.MainWindowHandle);
                }

                Application.Current.Shutdown();
            }
        }
Exemple #2
0
        public AssemblyManager(UIManager uiManager, DataAccess dataAccess, EventLoggerAccess logger)
        {
            _DataAccess = dataAccess;
            _DataAccess.setEvent(new SubsystemServiceListUpdateHandler(SubsystemServiceListUpdate));
            _Logger = logger;
            _UIManager = uiManager;
            _AssemblyInstances = new Dictionary<string, IDisplays>();

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["StartUpClean"]))
            {
                string directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                ConfigurationManager.AppSettings["SystemOperationMode"]);
                if (Directory.Exists(directory))
                {
                    DeleteDirectory(directory);
                }
            }
        }