Example #1
0
        /// <summary>
        /// Called by Rhino when the user wants to run the command.
        /// </summary>
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            var log_type = RockfishServerPlugIn.LogType();

            var go = new GetOption();

            go.SetCommandPrompt("Configuration options");
            go.AddOptionEnumList("Logging", log_type);
            while (true)
            {
                var res = go.Get();
                if (res == GetResult.Option)
                {
                    var option = go.Option();
                    if (null != option)
                    {
                        var list = Enum.GetValues(typeof(RockfishLog.LogType)).Cast <RockfishLog.LogType>().ToList();
                        log_type = list[option.CurrentListOptionIndex];
                    }
                    continue;
                }
                break;
            }

            RockfishServerPlugIn.SetLogType(log_type);

            return(Result.Success);
        }
Example #2
0
        /// <summary>
        /// Called by Rhino when the user wants to run the command.
        /// </summary>
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            if (!RockfishServerPlugIn.CheckForAdministrator())
            {
                return(Result.Cancel);
            }

            var service = RockfishServiceHost.TheServiceHost;

            if (service.IsRunning)
            {
                RhinoApp.WriteLine("Rockfish service already running.");
                return(Result.Success);
            }

            // Start the service
            var rc = service.Start();

            if (rc)
            {
                // Start the activity log (if not disabled)
                RockfishLog.TheLog.Start();
            }

            return(rc ? Result.Success : Result.Failure);
        }
Example #3
0
        /// <summary>
        /// Called by Rhino when the user wants to run the command.
        /// </summary>
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            if (!RockfishServerPlugIn.CheckForAdministrator())
            {
                return(Result.Cancel);
            }

            // Stop the activity log
            RockfishLog.TheLog.Stop();

            // Stop the service
            RockfishServiceHost.TheServiceHost.Stop();

            return(Result.Success);
        }