Ejemplo n.º 1
0
        protected async override void OnInitialized()
        {
            InitializeComponent();
            MainPage = new MainPage();

            ClientApi.Initialize();
            await EmbeddedResourceManager.Initialize(typeof(App).GetTypeInfo().Assembly);

            await NavigationService.NavigateAsync(!Settings.IsLoggedIn?Routes.Login() : $"{Routes.Matches(true)}");
        }
Ejemplo n.º 2
0
        private static void Main()
        {
            if (!EnsureNetVersionUsingNothingThatCrashesTheProcess())
            {
                return;
            }

            _workFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"AxCrypt" + Path.DirectorySeparatorChar);

            TypeMap.Register.Singleton <INow>(() => new Now());
            TypeMap.Register.Singleton <IReport>(() => new Report(_workFolderPath, 1000000));

            EmbeddedResourceManager.Initialize();

            string[] commandLineArgs = Environment.GetCommandLineArgs();

            RegisterTypeFactories(commandLineArgs[0]);
            New <IRuntimeEnvironment>().AppPath = commandLineArgs[0];

            CommandLine commandLine = new CommandLine(commandLineArgs.Skip(1));

            bool isFirstInstance = New <IRuntimeEnvironment>().IsFirstInstance;

            if (isFirstInstance && commandLine.HasCommands)
            {
                New <IRuntimeEnvironment>().IsFirstInstance = isFirstInstance = false;
                New <IRuntimeEnvironment>().RunApp("--start");
            }

            WireupEvents();

            try
            {
                if (isFirstInstance)
                {
                    RunInteractive(commandLine);
                }
                else
                {
                    RunBackground(commandLine);
                }
            }
            catch (Exception ex)
            {
                New <IReport>().Exception(ex);
                throw;
            }

            Resolve.CommandService.Dispose();
            TypeMap.Register.Clear();

            Environment.ExitCode = 0;
        }