private void CheckForAdminPrivileges(ClusterOperationType startupOperation)
 {
     if (!this.appMgr.HasAdminPrivileges)
     {
         this.trayIcon.Visible = false;
         Application.Exit();
         this.appMgr.RestartApplicationAsAdmin(startupOperation);
     }
 }
 private void CheckForPendingRestart(ClusterOperationType startupOperation)
 {
     if (this.appMgr.IsRestartPending)
     {
         this.trayIcon.Visible = false;
         Application.Exit();
         this.appMgr.RestartApplication(startupOperation);
     }
 }
Esempio n. 3
0
        private static string GetLaunchArguments(ClusterOperationType startupOperation)
        {
            StringBuilder argsBuilder = new StringBuilder(WaitForMutexArg);

            if (startupOperation != ClusterOperationType.None)
            {
                argsBuilder.Append(" -");
                argsBuilder.Append(startupOperation);
            }

            return(argsBuilder.ToString());
        }
        private void ExecuteOperation(ClusterOperationType operationType)
        {
            switch (operationType)
            {
#pragma warning disable 4014
            case ClusterOperationType.Manage:
                this.ManageClusterMenuItemClick(this, EventArgs.Empty); break;

            case ClusterOperationType.Reset:
                this.ResetCluster_ConfirmationObtained(); break;

            case ClusterOperationType.Start:
                this.StartClusterMenuItemClick(this, EventArgs.Empty); break;

            case ClusterOperationType.Stop:
                this.StopCluster_ConfirmationObtained(); break;

            case ClusterOperationType.SetupOneNodeCluster:
                this.SetupOneNodeClusterMenuItemClick(this, EventArgs.Empty); break;

            case ClusterOperationType.SetupFiveNodeCluster:
                this.SetupFiveNodeClusterMenuItemClick(this, EventArgs.Empty); break;

            case ClusterOperationType.SwitchToOneNodeCluster:
                this.SwitchToOneNodeCluster_ConfirmationObtained(); break;

            case ClusterOperationType.SwitchToFiveNodeCluster:
                this.SwitchToFiveNodeCluster_ConfirmationObtained(); break;

            case ClusterOperationType.Remove:
                this.RemoveCluster_ConfirmationObtained(); break;

            case ClusterOperationType.SetupOneNodeMeshCluster:
                this.SetupMeshOneNodeClusterMenuItemClick(this, EventArgs.Empty); break;

            case ClusterOperationType.SetupFiveNodeMeshCluster:
                this.SetupMeshFiveNodeClusterMenuItemClick(this, EventArgs.Empty); break;

            case ClusterOperationType.SwitchToMeshOneNodeCluster:
                this.SwitchToMeshOneNodeCluster_ConfirmationObtained(); break;

            case ClusterOperationType.SwitchToMeshFiveNodeCluster:
                this.SwitchToMeshFiveNodeCluster_ConfirmationObtained(); break;
#pragma warning restore 4014
            }
        }
Esempio n. 5
0
        public ApplicationManager(IReadOnlyCollection <string> appArgs)
        {
            this.mutex                        = null;
            this.waitForMutex                 = false;
            this.acquiredMutex                = false;
            this.startupOperationToExecute    = ClusterOperationType.None;
            this.clusterExistedAtStarup       = ClusterManager.IsClusterSetup;
            this.clusterResetInCurrentSession = false;

            if (appArgs.Count <= 2)
            {
                foreach (var arg in appArgs)
                {
                    if (arg == WaitForMutexArg)
                    {
                        this.waitForMutex = true;
                    }
                    else
                    {
                        this.startupOperationToExecute = ProjectUtility.GetClusterOperationTypeFromString(arg.Substring(1));
                    }
                }
            }
        }
Esempio n. 6
0
 private void Launch(ClusterOperationType startupOperation = ClusterOperationType.None)
 {
     this.Launch(false, GetLaunchArguments(startupOperation));
 }
Esempio n. 7
0
 private void LaunchInAdminMode(ClusterOperationType startupOperation = ClusterOperationType.None)
 {
     this.Launch(true, GetLaunchArguments(startupOperation));
 }
Esempio n. 8
0
 public void RestartApplication(ClusterOperationType startupOperation)
 {
     this.Launch(startupOperation);
 }
Esempio n. 9
0
 public void RestartApplicationAsAdmin(ClusterOperationType startupOperation)
 {
     this.LaunchInAdminMode(startupOperation);
 }