private void StartApp()
        {
            if (!Directory.Exists(this._runningAppPath))
            {
                CopyFiles();
            }

            string configFile   = Path.Combine(_runningAppPath, this._appName + ".exe.config");
            string cachePath    = Path.Combine(_runningAppPath, "_cache");
            string assemblyName = Path.Combine(_runningAppPath, this._appName + ".exe");

            AppDomainSetup appDomainSetup = new AppDomainSetup();

            appDomainSetup.ApplicationName   = this._appName;
            appDomainSetup.ShadowCopyFiles   = "true";  // Note: not a bool.
            appDomainSetup.CachePath         = cachePath;
            appDomainSetup.ConfigurationFile = configFile;

            // We need this when we run the app domain. This allows us to have the self-updating service host *NOT* reference PrestoCommon.
            //appDomainSetup.PrivateBinPath    = this._runningAppPath;  // This works too. Can fall back to this if there are any issues with ApplicationBase.
            appDomainSetup.ApplicationBase = this._runningAppPath;

            this._appDomain = AppDomain.CreateDomain(this._appName, AppDomain.CurrentDomain.Evidence, appDomainSetup);
            this._startStopControllerToRun = (IStartStop)this._appDomain.CreateInstanceFromAndUnwrap(assemblyName, this._fullyQualifiedClassName);
            this._startStopControllerToRun.CommentFromServiceHost =
                "Service host file version " + ReflectionUtility.GetFileVersion(Assembly.GetExecutingAssembly());
            Logger.LogInformation("Created app domain.");

            this._startStopControllerToRun.Start();
            Logger.LogInformation("Started app.");
        }
Exemple #2
0
 void IStartStop.Action(object type, ActionType actionType)
 {
     if (child is IStartStop)
     {
         IStartStop ss = child as IStartStop;
         ss.Action(type, actionType);
     }
 }
	    public IQueryable<CharacterClassViewModel> GetClasses(IStartStop metricInfo)
	    {
			metricInfo.Start("Get Records");
			var entityRecords = _characterClassRepository.GetAll();
			metricInfo.Stop();
			metricInfo.Start("Transform to model");
			var modelRecords = entityRecords.Select(CharacterClassMapper.MapEntityToModel).AsQueryable();
			metricInfo.Stop();
		    return modelRecords;
	    }
Exemple #4
0
 public static void ToggleRunningState(this IStartStop s)
 {
     if (s.IsRunning)
     {
         s.Stop();
     }
     else
     {
         s.Start();
     }
 }
Exemple #5
0
        public IQueryable <CharacterClassViewModel> GetClasses(IStartStop metricInfo)
        {
            metricInfo.Start("Get Records");
            var entityRecords = _characterClassRepository.GetAll();

            metricInfo.Stop();
            metricInfo.Start("Transform to model");
            var modelRecords = entityRecords.Select(CharacterClassMapper.MapEntityToModel).AsQueryable();

            metricInfo.Stop();
            return(modelRecords);
        }
        /// <summary>
        /// Performs start stop action
        /// </summary>
        /// <param name="desktop">Desktop</param>
        /// <param name="type">Action type</param>
        /// <param name="actionType">True in start and false in stop</param>
        static public void Action(this IDesktop desktop, object type, ActionType actionType)
        {
            IEnumerable <object> comp = desktop.AllComponents;

            foreach (object o in comp)
            {
                if (o is IStartStop)
                {
                    IStartStop ss = o as IStartStop;
                    ss.Action(type, actionType);
                }
            }
        }
 /// <summary>
 /// Performs action with form
 /// </summary>
 /// <param name="form">Form for action</param>
 /// <param name="type">Action type</param>
 /// <param name="actionType">Type of action</param>
 public static void Action(this Form form, object type, ActionType actionType)
 {
     if (form != null)
     {
         if (!form.IsDisposed)
         {
             if (form is IStartStop)
             {
                 IStartStop ss = form as IStartStop;
                 ss.Action(type, actionType);
             }
         }
     }
 }
Exemple #8
0
        void IStartStop.Action(object type, Diagram.UI.Interfaces.ActionType actionType)
        {
            this.actionType = actionType;
            if (form == null)
            {
                return;
            }
            if (form.IsDisposed)
            {
                return;
            }
            IStartStop ss = form;

            ss.Action(type, actionType);
        }
Exemple #9
0
        void IStartStop.Action(object type, ActionType actionType)
        {
            IStartStop ss = child;

            ss.Action(type, actionType);
        }
Exemple #10
0
        void IStartStop.Action(object type, ActionType actionType)
        {
            IStartStop ss = label;

            ss.Action(type, actionType);
        }