Ejemplo n.º 1
0
        protected override void ApplyGlobalApplicationSettingsOverrides(ChoGlobalApplicationSettings obj)
        {
            obj.TrayApplicationBehaviourSettings.TurnOn     = true;
            obj.TrayApplicationBehaviourSettings.TurnOnMode = ChoTrayAppTurnOnMode.OnMinimize;
            obj.TrayApplicationBehaviourSettings.HideTrayIconWhenMainWindowShown                  = false;
            obj.TrayApplicationBehaviourSettings.ContextMenuSettings.DisplayHelpMenuItem          = false;
            obj.TrayApplicationBehaviourSettings.ContextMenuSettings.DisplayAboutMenuItem         = false;
            obj.TrayApplicationBehaviourSettings.ContextMenuSettings.DisplayShowMainWndMenuItem   = true;
            obj.TrayApplicationBehaviourSettings.ContextMenuSettings.DisplayShowInTaskbarMenuItem = false;

            obj.ApplicationBehaviourSettings.SingleInstanceApp     = false;
            obj.ApplicationBehaviourSettings.ActivateFirstInstance = true;
        }
Ejemplo n.º 2
0
        internal static void OverrideFrxParams(ChoGlobalApplicationSettings gas)
        {
            if (gas == null)
            {
                return;
            }

            string serviceName = null;

            using (ChoCommandLineArgParser parser = new ChoCommandLineArgParser())
            {
                parser.Parse();
                foreach (KeyValuePair <string, string> keyValuePair in parser)
                {
                    if (keyValuePair.Key.ToUpper() == "@SN")
                    {
                        if (!keyValuePair.Value.IsNullOrWhiteSpace())
                        {
                            serviceName = gas.LogSettings.LogFolder = keyValuePair.Value.Trim();
                        }
                    }
                }
            }

            string command = null;

            using (ChoCommandLineArgParser parser = new ChoCommandLineArgParser())
            {
                parser.Parse();
                foreach (KeyValuePair <string, string> keyValuePair in parser)
                {
                    if (keyValuePair.Key.ToUpper() == "@I")
                    {
                        ChoApplication.ServiceInstallation = true;
                        command = "InstallService";
                        break;
                    }
                    else if (keyValuePair.Key.ToUpper() == "@U")
                    {
                        ChoApplication.ServiceInstallation = true;
                        command = "UninstallService";
                        break;
                    }
                    else if (keyValuePair.Key.ToUpper() == "@S")
                    {
                        ChoApplication.ServiceInstallation = true;
                        command = "StartService";
                        break;
                    }
                    else if (keyValuePair.Key.ToUpper() == "@T")
                    {
                        ChoApplication.ServiceInstallation = true;
                        command = "StopService";
                        break;
                    }
                    else if (keyValuePair.Key.ToUpper() == "@P")
                    {
                        ChoApplication.ServiceInstallation = true;
                        command = "PauseService";
                        break;
                    }
                    else if (keyValuePair.Key.ToUpper() == "@C")
                    {
                        ChoApplication.ServiceInstallation = true;
                        command = "ContinueService";
                        break;
                    }
                    else if (keyValuePair.Key.ToUpper() == "@E")
                    {
                        ChoApplication.ServiceInstallation = true;
                        command = "ExecuteCommand";
                        break;
                    }
                }
                if (ChoApplication.ServiceInstallation)
                {
                    gas.ApplicationBehaviourSettings.HideWindow        = false;
                    gas.ApplicationBehaviourSettings.SingleInstanceApp = true;
                    gas.ApplicationName         = "{0}.{1}".FormatString(gas.ApplicationNameWithoutExtension, command);
                    gas.EventLogSourceName      = "{0}.{1}".FormatString(gas.EventLogSourceName, command);
                    gas.LogSettings.LogFileName = "{0}.{1}".FormatString(GetLogFileName(serviceName, gas.LogSettings.LogFileName), command);
                    gas.LogSettings.LogFolder   = serviceName.IsNullOrWhiteSpace() ? command : Path.Combine(command, serviceName);
                    gas.LogSettings.DoAppendProcessIdToLogDir = false;
                }
            }
        }