예제 #1
0
        /// <summary>
        /// Loads the kernel.
        /// </summary>
        protected async void LoadKernel()
        {
            try
            {
                CompositionRoot = new ApplicationHost();

                Logger = CompositionRoot.LogManager.GetLogger("App");

                var splash = new SplashWindow(CompositionRoot.ApplicationVersion);

                splash.Show();

                await CompositionRoot.Init();

                splash.Hide();

                var task = CompositionRoot.RunStartupTasks();

                new MainWindow(CompositionRoot.LogManager, CompositionRoot, CompositionRoot.ServerConfigurationManager, CompositionRoot.UserManager, CompositionRoot.LibraryManager, CompositionRoot.JsonSerializer, CompositionRoot.DisplayPreferencesRepository).Show();

                await task.ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Logger.ErrorException("Error launching application", ex);

                MessageBox.Show("There was an error launching Media Browser: " + ex.Message);

                // Shutdown the app with an error code
                Shutdown(1);
            }
        }
예제 #2
0
파일: App.xaml.cs 프로젝트: Louiszyh/myStik
 private static void ShowSplash()
 {
     splashWindow = new SplashWindow();
     splashWindow.Show();
     ResetSplashCreated.Set();
     System.Windows.Threading.Dispatcher.Run();
 }
예제 #3
0
        public static void ShowSplashWindow(string statusText, string mode)
        {
            var thread = new Thread(new ThreadStart(
                                        delegate
            {
                _dispatcher = Dispatcher.CurrentDispatcher;

                _dispatcher.BeginInvoke(new Action(
                                            delegate
                {
                    _splashWindow = new SplashWindow(mode)
                    {
                        StatusText = statusText
                    };
                    _splashWindow.Show();
                }));

                Dispatcher.Run();
            }));

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();

            //_splashWindow = new SplashWindow(mode) { StatusText = statusText };
            //_splashWindow.Show();
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        public Form1()
        {
            InitializeComponent();
            sw = new SplashWindow(true, true, true);
            sw.Show();

            computeToolStripMenuItem.Enabled = false;
            WriteTextCallBack            = new PMed.WriteDelegate(ConsoleAppendText);
            ConsoleAppendTextCallBack    = new _ConsoleAppendTextCallBack(ConsoleAppendText);
            UpdateStatusBarCallBack      = new _UpdateStatusBarCallBack(UpdateStatusBar);
            UpdateSolutionVieverCallBack = new _UpdateSolutionVieverCallBack(UpdateSolutionViever);
            SolutionViewerClearCallBack  = new _SolutionViewerClearCallBack(SolutionViewerClear);

            try
            {
                pm           = new PMed3(WriteTextCallBack, 1, "PMedProb", false, false);
                pm.Progress += OnProgressReport;
            }
            catch (DllNotFoundException e)
            {
                MessageBox.Show(String.Format("Dll CoinOR not found!!!\r\nCannot Compute Set Covering (Step 3)\r\n\r\n{0}", e), "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show(e.Message);
                this.Close();
            }
        }
예제 #5
0
        private void ShowSplashScreen(GeneralSettingsModel generalSettingsModel)
        {
            var splashWindow = new SplashWindow
            {
                DataContext = new SplashWindowViewModel()
            };

            SplashScreen = splashWindow;

            if (generalSettingsModel.RememberScreenPosition)
            {
                var positionsInfo = new WindowPositionsInfo
                {
                    Width           = splashWindow.Width,
                    Height          = splashWindow.Height,
                    DisplaySettings = generalSettingsModel.DisplaySettings,
                    StartupLocation = WindowStartupLocation.CenterScreen
                };

                if (positionsInfo.DisplaySettings != null)
                {
                    positionsInfo.DisplaySettings.Maximized = false;
                }

                WindowPositionsService.SetPosition(splashWindow, positionsInfo);
            }

            splashWindow.Show();

            ResetSplashCreated.Set();
            Dispatcher.Run();
        }
예제 #6
0
 protected override void OnStartup(StartupEventArgs e)
 {
     BootLog.Log("App.OnStartup start");
     RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
     try {
         appMutex = new Mutex(true, _appPipName, out createdNew);
     }
     catch (Exception) {
         createdNew = false;
     }
     if (createdNew)
     {
         if (!NTMiner.Windows.Role.IsAdministrator)
         {
             AppHelper.RunAsAdministrator();
             return;
         }
         BootLog.Log("new SplashWindow");
         SplashWindow splashWindow = new SplashWindow();
         splashWindow.Show();
         NTMinerRoot.Inited = OnNTMinerRootInited;
     }
     else
     {
         try {
             if (CommandLineArgs.IsWorkEdit)
             {
                 object argumentsValue = NTMiner.Windows.Registry.GetValue(Registry.Users, ClientId.NTMinerRegistrySubKey, "Arguments");
                 if (argumentsValue != null && (string)argumentsValue == $"--controlcenter --workid={CommandLineArgs.WorkId}")
                 {
                     AppHelper.ShowMainWindow(this, _appPipName);
                 }
                 else
                 {
                     NTMinerClientDaemon.Instance.RestartNTMiner(NTMinerRoot.MinerClientHost, 3336, CommandLineArgs.WorkId, null);
                     this.Shutdown();
                 }
             }
             else
             {
                 AppHelper.ShowMainWindow(this, _appPipName);
             }
         }
         catch (Exception) {
             DialogWindow.ShowDialog(message: "另一个NTMiner正在运行,请手动结束正在运行的NTMiner进程后再次尝试。", title: "alert", icon: "Icon_Error");
             Process   currentProcess = Process.GetCurrentProcess();
             Process[] processes      = Process.GetProcessesByName(currentProcess.ProcessName);
             foreach (var process in processes)
             {
                 if (process.Id != currentProcess.Id)
                 {
                     NTMiner.Windows.TaskKill.Kill(process.Id);
                 }
             }
         }
     }
     base.OnStartup(e);
     BootLog.Log("App.OnStartup end");
     BootLog.SyncToDisk();
 }
예제 #7
0
        private async void Start()
        {
            var splash = new SplashWindow();

            splash.Show();

            var bootstrapper = new Bootstrapper();
            var container    = bootstrapper.Build();

            Log.Info("Initializing reactive trader API...");
            var sw = Stopwatch.StartNew();
            var reactiveTraderApi = container.Resolve <IReactiveTrader>();

            var username = container.Resolve <IUserProvider>().Username;

            reactiveTraderApi.Initialize(username, container.Resolve <IConfigurationProvider>().Servers, container.Resolve <ILoggerFactory>());
            Log.InfoFormat("Reactive trader API initialized in {0}ms", sw.ElapsedMilliseconds);

            MainWindow = new MainWindow();
            var shellViewModel = container.Resolve <IShellViewModel>();

            MainWindow.Content = new ShellView(shellViewModel);

            await Task.Delay(TimeSpan.FromSeconds(1.5));

            splash.Close();
            MainWindow.Show();
            Log.InfoFormat("Main UI displayed {0}ms after process start.", DateTime.Now - Process.GetCurrentProcess().StartTime);
        }
        private void showSplash()
        {
            ThreadStart threadStart = () =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    mSplashWindow.Show();
                    autoResetEvent.Set();
                });
            };

            var thread = new Thread(threadStart)
            {
                Name = "Splash Thread", IsBackground = true
            };

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            autoResetEvent.WaitOne();
            //    await Application.Current.Dispatcher.BeginInvoke((Action)async delegate
            //     {
            //         mSplashWindow.Show();
            //         Thread.Sleep(4000);
            //         await Task.Delay(4000);
            //         autoResetEvent.Set();
            //     });
            //autoResetEvent.WaitOne();
            //await Task.Delay(0);
        }
예제 #9
0
파일: App.xaml.cs 프로젝트: pittruff/myStik
 private static void ShowSplash()
 {
     splashWindow = new SplashWindow();
     splashWindow.Show();
     ResetSplashCreated.Set();
     System.Windows.Threading.Dispatcher.Run();
 }
예제 #10
0
        private void ShowSplashWindow()
        {
            var win = new SplashWindow(_appHost.ApplicationVersion);

            win.Show();

            _splashWindow = win;
        }
예제 #11
0
 //Shows Progressbar
 private void ShowProgressbar()
 {
     sw       = new SplashWindow("Please wait. Loading BSky Environment...");
     sw.Owner = (Application.Current.MainWindow);
     sw.Show();
     sw.Activate();
     defaultcursor        = Mouse.OverrideCursor;
     Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
 }
예제 #12
0
        internal static Window ShowSplashWindow()
        {
            var splashWindow = new SplashWindow();

            // Show the window
            splashWindow.Show();

            return(splashWindow);
        }
        private static void ShowSplash()
        {
            SplashWindow wnd = new SplashWindow();

            SplashScreen = wnd;
            wnd.Show();
            resetSplash.Set();
            Dispatcher.Run();
        }
예제 #14
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Initialize the splash screen and set it as the application main window.
            var splashScreen = new SplashWindow();

            this.MainWindow = splashScreen;
            splashScreen.Show();

            // In order to ensure the UI stays responsive, we need to do the work on a different thread.
            Task.Factory.StartNew(() =>
            {
                // Load settings.
                string settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), Settings.SettingsPath);

                if (File.Exists(settingsPath))
                {
                    string settingsJson = FileManager.ReadTextFile(settingsPath, Encoding.UTF8);
                    Settings.Instance   = JsonSerializer.Deserialize <Settings>(settingsJson);
                }

                // Load history.
                string historyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), Settings.HistoryPath);

                if (File.Exists(settingsPath))
                {
                    string historyJson = FileManager.ReadTextFile(historyPath, Encoding.UTF8);
                    History.Instance   = JsonSerializer.Deserialize <History>(historyJson);
                }

                // Load Workspace.
                Workspace.Instance = new Workspace();

                // Load theme.
                if (Settings.Instance.ThemeStyle == ThemeStyle.Light)
                {
                    UpdateSkin(SkinType.Default);
                    Workspace.Instance.SelectedTheme = new Vs2013LightTheme();
                }
                else
                {
                    UpdateSkin(SkinType.Dark);
                    Workspace.Instance.SelectedTheme = new Vs2013DarkTheme();
                }

                // Since we're not on the UI thread once we're done we need to use the Dispatcher to create and show the main window.
                this.Dispatcher.Invoke(() =>
                {
                    // Initialize the main window, set it as the application main window and close the splash screen.
                    var mainWindow  = new MainWindow();
                    this.MainWindow = mainWindow;
                    mainWindow.Show();
                    splashScreen.Close();
                });
            });
        }
예제 #15
0
        void App_Startup(object sender, StartupEventArgs e)
        {
            SplashWindow splash = new SplashWindow();

            //KöTaf.WPFApplication.Views.LoginWindow newWindow = new KöTaf.WPFApplication.Views.LoginWindow();
            //MainWindow newWindow = new MainWindow(null);
            //newWindow.Show();
            splash.Show();
            splash.Close();
        }
예제 #16
0
 //Shows Progressbar
 private void ShowProgressbar()
 {
     sw       = new SplashWindow("Please wait. Loading BlueSky Statistics...");
     sw.Owner = (Application.Current.MainWindow);
     //bw.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     //bw.Visibility = Visibility.Visible;
     sw.Show();
     sw.Activate();
     defaultcursor        = Mouse.OverrideCursor;
     Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
 }
예제 #17
0
 void Application_Startup(object sender, StartupEventArgs e)
 {
     if (Vulnerator.Properties.Settings.Default["Environment"].ToString().Equals("Undefined"))
     {
         SplashWindow splashWindow = new SplashWindow();
         splashWindow.Show();
     }
     else
     {
         MainWindow mainWindow = new MainWindow();
         mainWindow.Show();
     }
 }
예제 #18
0
    protected bool PulseGTK()
    {
        if (quitNow)
        {
            return(false);
        }

        //if( ( needEndSplashWin && pingEnd )
        //		|| ! thread.IsAlive) {
        if (needEndSplashWin || !thread.IsAlive)
        {
            LogB.ThreadEnding();
            fakeSplashButton.Click();

            LogB.Information("splash window ending here");
            LogB.ThreadEnded();
            return(false);
        }
        //need to do this, if not it crashes because chronopicWin gets died by thread ending
        splashWin = SplashWindow.Show();
        //Log.WriteLine("splash");

        if (updatingDB)
        {
            splashWin.ShowProgressbar("updating");
            splashWin.UpdateLabel(splashMessage + " " + Sqlite.PrintConversionText());

            splashWin.UpdateProgressbar("version", Sqlite.PrintConversionVersion());
            splashWin.UpdateProgressbar("rate", Sqlite.PrintConversionRate());
            splashWin.UpdateProgressbar("subrate", Sqlite.PrintConversionSubRate());
        }
        else if (creatingDB)
        {
            splashWin.ShowProgressbar("creating");
            splashWin.UpdateProgressbar("version", Sqlite.PrintCreation());

            //splashWin.UpdateProgressbar("rate", Sqlite.PrintConversionRate());
            splashWin.UpdateProgressbar("subrate", Sqlite.PrintConversionSubRate());
        }

        if (needUpdateSplashMessage)
        {
            splashWin.UpdateLabel(splashMessage);
            needUpdateSplashMessage = false;
        }


        Thread.Sleep(50);
        //Log.Write(" (PulseGTK:" + thread.ThreadState.ToString() + ") ");
        return(true);
    }
    private async void App_Startup(object sender, StartupEventArgs e)
    {
        var splash = new SplashWindow();

        splash.Show();

        await InitializeAsync();

        var main = new MainWindow();

        main.Show();
        MainWindow = main;
        splash.Close();
    }
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var cacheDirectoryPath = ConfigurationManager.AppSettings["CacheDirectoryPath"];

            if (!Directory.Exists(cacheDirectoryPath))
            {
                Directory.CreateDirectory(cacheDirectoryPath);
            }

            _splashWindow = new SplashWindow();
            _splashWindow.Show();
        }
예제 #21
0
파일: App.xaml.cs 프로젝트: litfung/Jaze
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     if (IsDupplicate())
     {
         MessageBox.Show("Application is already running...");
         Current.Shutdown();
     }
     else
     {
         splashWindow = new SplashWindow();
         splashWindow.Show();
         Thread thread = new Thread(InitData);
         thread.Start();
     }
 }
예제 #22
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            SplashWindow splash = new SplashWindow();

            splash.Show();

            //Read the last used Workspace:
            string lastWorkspace = ReadWorkSpaceFromRegestry();

            SwitchWorkspace(lastWorkspace, null);

            MainWindow main = new MainWindow();

            Thread.Sleep(3000);
            splash.Close();
            main.Show();
        }
예제 #23
0
        protected async override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var splashWindow = new SplashWindow
            {
                Accent             = SplashAccent,
                AllowsTransparency = true,
                Image   = Splash,
                Opacity = 0
            };

            splashWindow.Show();
            await splashWindow.FadeIn();

            _ = StartTasks.Invoke(splashWindow);
        }
예제 #24
0
        private async void App_Startup(object sender, StartupEventArgs e)
        {
            var splashVM = new SplashViewModel();
            var splash   = new SplashWindow
            {
                DataContext = splashVM,
            };

            splash.Show();

            await Task.Yield();

            await splashVM.InitializeAsync(null);

            splashVM.Info = "service1 initializing...";
            // await service1.InitializeAsync();
            await Task.Delay(150);

            splashVM.Info = "service2 initializing...";
            await Task.Delay(250);

            splashVM.Info = "service3 initializing...";
            await Task.Delay(350);

            splashVM.Info = "service4 initializing...";
            await Task.Delay(450);

            splashVM.Info = "service5 initializing...";
            await Task.Delay(550);

            splashVM.Info = "finished.";

            var mainVM = new MainViewModel();

            MainWindow = new MainWindow
            {
                DataContext = mainVM,
            };
            MainWindow.Show();
            await mainVM.InitializeAsync(null);

            await Task.Delay(1000);

            splash.Close();
        }
예제 #25
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.Loaded -= MainWindow_Loaded;

            SplashWindow _splash = new SplashWindow();

            _splash.Show();

            MessageListener.Instance.StartWork(GetStageText(0), new DispatcherOperationCallback(InitStage0));
            Thread.Sleep(1);

            MessageListener.Instance.StartWork(GetStageText(1), new DispatcherOperationCallback(InitStage1));
            Thread.Sleep(1);

            MessageListener.Instance.StartWork(GetStageText(2), new DispatcherOperationCallback(InitStage2));
            Thread.Sleep(1);

            _splash.Close();
        }
예제 #26
0
    public ChronoJump(string [] args)
    {
        Application.Init();

        //start threading to show splash window
        SplashWindow.Show();

        fakeSplashButton          = new Gtk.Button();
        fakeSplashButton.Clicked += new EventHandler(on_splash_ended);

        //LongoMatch.Video.Capturer.GstCameraCapturer.InitBackend("");

        thread = new Thread(new ThreadStart(sqliteThings));
        GLib.Idle.Add(new GLib.IdleHandler(PulseGTK));
        LogB.ThreadStart();
        thread.Start();

        Application.Run();
    }
예제 #27
0
        public App()
        {
            InitializeComponent();

            log.Trace("Initializing App", null);

            _ = (new UpdateService()).CheckUpdates();

            splash  = new SplashWindow();
            overlay = new OverlayWindow(Forms.Screen.PrimaryScreen);
            splash.Show();

            Task.Run(() => {
                AppService.Instance.Start();

                App.Current.Dispatcher.Invoke(delegate {
                    splash.Close();
                });
            });
        }
예제 #28
0
 private void ShowMainWindow(string[] args, IContainer container)
 {
     if (args.Length > 0)
     {
         var queryParams    = container.Resolve <IUriProtocolService>().GetUriParams(args);
         var signalRService = container.Resolve <ISignalRService>();
         var mainWindow     = new MainWindow
         {
             DataContext = new MainWindowViewModel(signalRService, queryParams)
         };
         mainWindow.Show();
     }
     else
     {
         var splash = new SplashWindow
         {
             DataContext = new SplashWindowViewModel()
         };
         splash.Show();
     }
 }
예제 #29
0
        protected override void OnStartup(StartupEventArgs e)
#endif
        {
            MainWindow mainWindow = new MainWindow();

#if !DEBUG
            SplashWindow splashWindow = new SplashWindow();

            splashWindow.Show();

            await Task.Delay(2000);
#endif

            PrepareApp();
            mainWindow.Show();
#if !DEBUG
            splashWindow.Close();
#endif

            base.OnStartup(e);
        }
예제 #30
0
        public void OnInitialized(IContainerProvider containerProvider)
        {
            Dispatcher.CurrentDispatcher.BeginInvoke(() =>
            {
                EventAggregator.GetEvent <CloseSplashEvent>().Publish(new CloseSplashEvent());
            });

            WaitForCreation = new AutoResetEvent(false);

            void showSplash()
            {
                Dispatcher.CurrentDispatcher.BeginInvoke(() =>
                {
                    SplashWindow splash = containerProvider.Resolve <SplashWindow>();

                    EventAggregator.GetEvent <CloseSplashEvent>().Subscribe(e =>
                    {
                        Thread.Sleep(500);
                        splash.Dispatcher.BeginInvoke(splash.Close);
                    }, ThreadOption.PublisherThread, true);

                    splash.Show();

                    WaitForCreation.Set();
                });

                Dispatcher.Run();
            }

            Thread thread = new Thread(showSplash)
            {
                Name = "Splash Thread", IsBackground = true
            };

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();

            WaitForCreation.WaitOne();
        }
예제 #31
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (this.ParseCommandLine() == false)
            {
                this.Shutdown();
                return;
            }

            try
            {
                var splash = new SplashWindow()
                {
                    Title      = AppUtility.ProductName,
                    ThemeColor = Settings.Default.ThemeColor,
                    Background = Settings.Default.Background,
                    Foreground = Settings.Default.Foreground
                };
                splash.Show();

                if (this.FindResource("bootstrapper") is AppBootstrapper bootstrapper)
                {
                    bootstrapper.Initialize();
                }
                base.OnStartup(e);
                splash.Close();
            }
            catch (ConfigurationErrorsException cee)
            {
                foreach (var exception in cee.Errors)
                {
                    CremaLog.Error(exception);
                }

                Settings.Default.Reset();

                MessageBox.Show($"설정 파일을 초기화 하였습니다.\r\n응용 프로그램을 다시 시작하십시오.\r\n\r\n{cee}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                throw;
            }
        }