Пример #1
0
        /// <summary>
        /// Start a new application using manifest metadata
        /// </summary>
        /// <param name="manifest">Application manifest</param>
        /// <returns></returns>
        public ApplicationProcess StartApplication(AppManifest manifest)
        {
            string viewLocation = FSHelper.NormalizeLocation($"{manifest.Location}\\{manifest.MainPage}");

            Log($"Starting application from package '{manifest.Domain}'");

            if (!File.Exists(viewLocation))
            {
                throw new LauncherException($"Failed to start application '{manifest.Name}' ({manifest.Domain}). View not found.");
            }

            ApplicationProcess proc = ProcessManager.GetInstance().CreateProcess();

            proc.Name       = manifest.Name;
            proc.Domain     = manifest.Domain;
            proc.DomainPath = manifest.Location;

            // TODO: Add icon loader
            proc.Host.ViewName = manifest.MainPage;
            proc.Host.Styles   = manifest.Window;
            proc.Host.Label    = manifest.Name;


            proc.Start();
            proc.Host.Show();

            return(proc);
        }
Пример #2
0
        private void OnProcessCreated(ApplicationProcess process, EventArgs e)
        {
            InitializeComponent();
            InitializeWebView();
            Show();

            ApplyStyles();
        }
Пример #3
0
        private void OnProcessDie(ApplicationProcess process, EventArgs e)
        {
            if (!WasClosed)
            {
                Close();
            }

            Cef.Shutdown();
        }
Пример #4
0
        /// <summary>
        /// Create and register a new empty process
        /// </summary>
        /// <returns></returns>
        public ApplicationProcess CreateProcess()
        {
            ApplicationProcess process = new ApplicationProcess(this)
            {
                Id    = LastProcessId + 1,
                State = ApplicationProcess.ProcessState.Idle
            };

            process.Host = new ApplicationHost(process);

            Processes.Add(process.Id, process);

            LastProcessId = process.Id + 0;

            Log($"Created a new process with PID: {process.Id}");

            return(process);
        }
Пример #5
0
 public ApplicationHost(ApplicationProcess process)
 {
     AppProcess                = process;
     AppProcess.ProcessKill   += new ApplicationProcess.ProcessEventHandler(OnProcessDie);
     AppProcess.ProcessCreate += new ApplicationProcess.ProcessEventHandler(OnProcessCreated);
 }
Пример #6
0
 private void OnProcessDie(ApplicationProcess process, EventArgs e)
 {
 }