Exemplo n.º 1
0
    public int Main(int argc, string[] argv)
    {
        if (argc < 1)
        {
            Console.WriteLine("{app} [args]");
            return(-1);
        }

        int exitCode = 0;

#if DESKTOP // CORECLR_TODO: Classic tracing
        var listener = new ConsoleTraceListener();
        Trace.Listeners.Add(listener);
        Trace.AutoFlush = true;
#endif

        string path = Path.GetFullPath(argv[0]);

        _container = new HostContainer();

        AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;

        var host = new RootHost(path);

        using (_container.AddHost(host))
        {
            exitCode = ExecuteMain(path, argv.Skip(1).ToArray());
        }

        AppDomain.CurrentDomain.AssemblyResolve -= OnAssemblyResolve;

        return(exitCode);
    }
Exemplo n.º 2
0
        // REVIEW: Root phases are special cased in a variety of locations.  Perhaps we can simplify.
        public void ExecutePhaseWorkflowGraph(IIR RootIR)
        {
            // Setup Root Phases
            List <PhaseExecutionHost> RootHosts = this._PhaseWorkflow.FindAll(delegate(PhaseExecutionHost Host) { return(Host.IsRootPhase); });

            foreach (PhaseExecutionHost RootHost in RootHosts)
            {
                RootHost.SupplyRootIR(RootIR);
            }


            // Check Graph For Cycles
            if (!this.IsPhaseWorkflowGraphAcyclic)
            {
                Message.Trace(Severity.Error, Resources.ErrorWorkflowCycleDetected, this.Name);
                return;
            }


            // Execute Graph
            List <EventWaitHandle>    ExecutionWaitHandles = new List <EventWaitHandle>();
            List <PhaseExecutionHost> NotStarted           = this._PhaseWorkflow.FindAll(delegate(PhaseExecutionHost Host) { return(!Host.ExecutionStarted); });

            while (NotStarted.Count > 0)
            {
                List <PhaseExecutionHost> Runnable = NotStarted.FindAll(delegate(PhaseExecutionHost Host) { return(Host.IsPredecessorIRFullySpecified); });

                // TODO: Should we use the ThreadPool here?
                foreach (PhaseExecutionHost Host in Runnable)
                {
                    EventWaitHandle ExecutionWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Host.WorkflowUniqueName);
                    ExecutionWaitHandles.Add(ExecutionWaitHandle);

                    ThreadStart PhaseThreadJob = new ThreadStart(delegate() { Host.Execute(ExecutionWaitHandle); });
                    Thread      PhaseThread    = new Thread(PhaseThreadJob);

                    PhaseThread.Start();
                }

                int index = EventWaitHandle.WaitAny(ExecutionWaitHandles.ToArray());
                ExecutionWaitHandles.RemoveAt(index);

                NotStarted = this._PhaseWorkflow.FindAll(delegate(PhaseExecutionHost Host) { return(!Host.ExecutionStarted); });
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            await DataService.Instance.LoadAsync();

            // generate live tiles
            TileHelper.GenerateSceduledTileNotifications(DataService.Instance.Contacts, 3);

            // update cortana voice command file
            CortanaHelper.WriteAndUpdateVoiceCommandDefinition(DataService.Instance.Contacts);

            // Load app via secondary tile
            if (e.TileId != "App")
            {
                foreach (var item in DataService.Instance.Contacts)
                {
                    if (e.TileId == item.Id)
                    {
                        Window.Current.Content = new ContactDetailPage(item);
                        Window.Current.Activate();
                        return;
                    }
                }
            }

            var rootHost = new RootHost();

            Window.Current.Content = rootHost;

            if (await TileHelper.UpdateUnpinnedSecondaryTilesInContacts(DataService.Instance.Contacts))
            {
                // update model consistency
                await DataService.Instance.SaveAsync();
            }

            Window.Current.Activate();
        }
Exemplo n.º 4
0
 public void DockRoot(ViewBase view)
 {
     RootHost.AddView(view);
 }