コード例 #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var s = new SplashScreen("Views/splashscreen.jpg");

            s.Show(false);

            SelectedProfilePath = $"{PROFILEFOLDER}/{selectedProfileName}";
            ShowVideos          = true;
            IsEditModeActive    = false;
            ShutdownMode        = ShutdownMode.OnMainWindowClose;

            if (outputDevice == null)
            {
                outputDevice = new WaveOutEvent();
                outputDevice.PlaybackStopped += OnPlaybackStopped;
            }

            mainViewModel = new MainViewModel();

            LoadPlugins();

            MainWindowView wnd = new MainWindowView(mainViewModel);

            MainWindow = wnd;
            wnd.Show();

            s.Close(TimeSpan.FromSeconds(1));
        }
コード例 #2
0
 public void Run()
 {
     RegisterViews();
     var vm = MakeAndRegisterMainViewModel();
     var view = new MainWindowView {ViewModel = vm};
     view.Show();
 }
コード例 #3
0
        /// <inheritdoc />
        protected override void OnStartup(StartupEventArgs e)
        {
            try
            {
                Core.Start(Current);

                var controller = new MainTabPresentationController(Core);

                controller.MessageReceived += OnControllerMessageReceived;
                controller.Initialize();

                var view = new MainWindowView {
                    DataContext = controller
                };

                view.Show();

                Core.AttachMainWindow(view);

                view.Closing += OnViewClosing;

                Core.AddMessageSeparator();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                throw;
            }
        }
コード例 #4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            MainWindowView mainWindowView = new MainWindowView();

            mainWindowView.Show();
        }
コード例 #5
0
        private void OnAppStartup(object sender, StartupEventArgs e)
        {
            var viewModel = new MainWindowViewModel(true);
            var view      = new MainWindowView(viewModel);

            view.Show();
        }
コード例 #6
0
ファイル: App.xaml.cs プロジェクト: sschottler/MVVMSample
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            MainWindowView view = new MainWindowView();

            //inject dependencies (could use a dependency injection framework for this, but not strictly necessary):
            ICustomerRepository    customerRepository    = new CustomerRepository();
            IProductRepository     productRepository     = new ProductRepository();
            ILocalizationService   localizationService   = new LocalizationService();
            IUpdateService         updateService         = new UpdateService();
            IMessageBoxService     messageBoxService     = new MessageBoxService();
            IDialogService         dialogService         = new DialogService();
            IAppDialogService      appDialogService      = new AppDialogService(dialogService, localizationService, () => new LanguageSelectionView(), () => new AboutView());
            IOpenFileDialogService openFileDialogService = new OpenFileDialogService();
            ISaveFileDialogService saveFileDialogService = new SaveFileDialogService();

            MainWindowViewModel viewModel = new MainWindowViewModel(
                customerRepository,
                productRepository,
                updateService,
                messageBoxService,
                appDialogService,
                openFileDialogService,
                saveFileDialogService,
                localizationService);

            //could also be wired up and handled in MainWindow.xaml.cs code behind (maybe in DataContextChanged override for example)
            //also could have a controller class listening to this event
            viewModel.RequestClose += (s, args) => view.Close();

            view.DataContext = viewModel;
            view.Show();
        }
コード例 #7
0
        private async void LoginValidation(object parameter)
        {
            try
            {
                ErrorMsgVisibility = Visibility.Hidden;
                var win = parameter as Window;
                await AuthenticateUser();

                if (AdminList.Count == 0)
                {
                    ErrorMsg           = Properties.Resources.AuthenticationFailedMsg;
                    ErrorMsgVisibility = Visibility.Visible;
                }

                else
                {
                    MainWindowView _mainWindow = new MainWindowView(_log);
                    _mainWindow.Show();
                    if (win != null)
                    {
                        win.Close();
                    }
                    _log.Message("User Authenticated");
                }
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                _log.Error(ex);
                _log.Message("Unable to connect to database");
                ErrorMsg           = Properties.Resources.DatabaseConnFailedMsg;
                ErrorMsgVisibility = Visibility.Visible;
            }
        }
コード例 #8
0
        public void Execute(object parameter)
        {
            if (mLoginViewModel.CanLogin())
            {
                if (mLoginViewModel.Login())
                {
                    if (mLoginViewModel.CurrentUser.Accounts.Count == 0)
                    {
                        MessageBox.Show("Jelenleg nincs számlája, kérem hozzon létre egyet!", "Hiányzó számla");
                        var newAccount = new AccountViewModel(mLoginViewModel.CurrentUser);
                        if (newAccount.CreateInteractive() == false)
                        {
                            return;
                        }
                    }

                    mainWindowView = new MainWindowView(mLoginViewModel.CurrentUser.UserID);
                    mainWindowView.Show();
                }
                else
                {
                    MessageBox.Show("Rossz felhasználónév vagy jelszó!");
                    mLoginViewModel.loginPage.clearPassword();
                }
            }
        }
コード例 #9
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            MainWindowVM   viewModel  = new MainWindowVM();
            MainWindowView mainWindow = new MainWindowView(viewModel);

            mainWindow.Show();
        }
コード例 #10
0
        public void Execute(object viewModel)
        {
            var baseViewModel = viewModel as BaseViewModel;

            baseViewModel?.OnRequestClose();

            mainWindowView.Show();
        }
コード例 #11
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            MainWindowView vw = new MainWindowView();

            // MainWindowViewModel vm = new MainWindowViewModel();
            // vw.DataContext = vm;
            vw.Show();
        }
コード例 #12
0
        public App()
        {
            var mw = new MainWindowView
            {
            };

            mw.Show();
        }
コード例 #13
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Window window = new MainWindowView();

            window.Show();

            base.OnStartup(e);
        }
コード例 #14
0
ファイル: App.xaml.cs プロジェクト: melnyk-a/CarRepairShop
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var            container  = CreateContainer();
            MainWindowView mainWindow = container.Get <MainWindowView>();

            mainWindow.Show();
        }
コード例 #15
0
        void Application_Startup(object sender, StartupEventArgs e)
        {
            MainWindow = new MainWindowView();
            MainWindow.Show();

            var splash = new SplashWindowView();

            splash.Show();
        }
コード例 #16
0
 public void Show(UIApplication uiApp, ExternalEvent exEvent)
 {
     if (_mainWindow != null && _mainWindow == null)
     {
         return;
     }
     _mainWindow = new MainWindowView(uiApp, exEvent);
     _mainWindow.Show();
 }
コード例 #17
0
ファイル: App.xaml.cs プロジェクト: Samoykin/Cindy
        /// <summary>Initializes a new instance of the <see cref="App" /> class.</summary>
        public App()
        {
            var mw = new MainWindowView
            {
                DataContext = new MainViewModel()
            };

            mw.Show();
        }
コード例 #18
0
ファイル: App.xaml.cs プロジェクト: alexxd0v/Calc
        public App()
        {
            MainWindowView win = new MainWindowView()
            {
                DataContext = new MainWindowViewModel()
            };

            win.Show();
        }
コード例 #19
0
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);
        var appInfo = new AppInfo("NickvisionApp", "A template for creating Nickvision applications.", new Version(2022, 5, 0), "- Initial Release", "(C) Nickvision 2021-2022");

        MainWindow = new MainWindowView(appInfo);
        new SplashDialogView(appInfo).ShowDialog();
        MainWindow.Show();
    }
コード例 #20
0
        protected virtual void OnLoginSuccess()
        {
            //NotifyIconControl.Instance.notifyIcon.ContextMenu.MenuItems["ExitApp"].Click -= ItemExitClick;
            //NotifyIconControl.Instance.notifyIcon.MouseClick -= OnNotifyIconMouseClick;
            //NotifyIconControl.Instance.notifyIcon.Visible = false;
            //this.LoginSuccessEvent?.Invoke();
            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
            stopWatch.Start();

            System.Windows.Application.Current.Dispatcher.Invoke(() =>
            {
                MainWindowViewModel model = new MainWindowViewModel();
                var result = model.GetGroupList();
                if (!result)
                {
                    loginCount++;
                    //如果尝试3获取数据失败,返回登录页面
                    if (loginCount >= 3)
                    {
                        MessageBoxWindow.Show("尝试多次获取群数据失败,请联系管理员。", GlobalVariable.WarnOrSuccess.Warn);
                        if (IsLoginSuccess)
                        {
                            var errorCode = 0;
                            var errorMsg  = string.Empty;
                            //发送状态
                            AntSdkService.AntSdkUpdateCurrentUserState((int)GlobalVariable.OnLineStatus.OffLine,
                                                                       ref errorCode, ref errorMsg);
                            //停止SDK
                            SDK.AntSdk.AntSdkService.StopAntSdk(ref errorCode, ref errorMsg);
                            AudioChat.ExitClearApi();
                        }
                        System.Windows.Application.Current.Shutdown();
                        CommonMethods.StartApplication(System.Windows.Forms.Application.StartupPath + "/AntennaChat.exe");
                        return;
                    }
                    OnLoginSuccess();
                    return;
                }
                //model.DownloadUserHeadImage();
                MainWindowView mainWindow = new MainWindowView {
                    DataContext = model
                };
                //model.InitMainVM();
                if (this.LoginWindow != null)
                {
                    var loginWindow = LoginWindow as LoginWindowView;
                    loginWindow?.taskbarIcon.Dispose();
                }
                loginCount = 0;
                mainWindow.Show();
                GlobalVariable.LastLoginDatetime = DateTime.Now;
                this.LoginWindow?.Close();
            });
            stopWatch.Stop();
            Antenna.Framework.LogHelper.WriteDebug($"[Model_LoginSuccessEvent({stopWatch.Elapsed.TotalMilliseconds}毫秒)]");
        }
コード例 #21
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var mainView = new MainWindowView();

            _mainViewModel       = new MainWindowViewModel(mainView.Dispatcher);
            mainView.DataContext = _mainViewModel;
            mainView.Show();
        }
コード例 #22
0
ファイル: App.xaml.cs プロジェクト: Anatolii-B/TestApp
		public App()
		{
			var mw = new MainWindowView
			{
				DataContext = new MainViewModel()
			};

			mw.Show();

		}
コード例 #23
0
        public App()
        {
            //Main view
            var mw = new MainWindowView
            {
                //View Model for main view
                DataContext = new MainWindowViewModel()
            };

            mw.Show();
        }
コード例 #24
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var colorManager     = new ColorManager();
            var viewModelFactory = new ViewModelFactory(colorManager);
            var mainViewModel    = new MainWindowViewModel(colorManager, viewModelFactory);
            var view             = new MainWindowView(mainViewModel);

            view.Show();
        }
コード例 #25
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            ConfigureServices(InversionOfControlContainer.Instance);

            Application.Current.Resources.Add(InversionOfControlKey.IocWpfContainer, InversionOfControlContainer.Instance);

            MainWindowView mainWindowView = new MainWindowView();

            mainWindowView.Show();
        }
コード例 #26
0
ファイル: App.xaml.cs プロジェクト: mig-l-f/CSharpCourse
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            BasketList shopping_basket = new BasketList();
            //FezSelection window = new FezSelection(shopping_basket);
            MainWindowView window    = new MainWindowView();
            var            viewModel = new MainWindowViewModel(shopping_basket);

            window.DataContext = viewModel;
            window.Show();
        }
コード例 #27
0
        public static void Start()
        {
            var main = new MainWindowView();
            var vm   = new MainWindowViewModel(main)
            {
                WindowTitle = "Mupen64 Editor"
            };

            main.DataContext = vm;

            main.Show();
        }
コード例 #28
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //Composition root:
            var blockRepository = new BlockRepository(new XmlLoader(), BlocksFileName);
            var window          = new MainWindowView
            {
                DataContext = new MainWindowViewModel(blockRepository)
            };

            window.Show();
            base.OnStartup(e);
        }
コード例 #29
0
        public FlintstoneViewerBL()
        {
            _mainWindowViewModel = new MainWindowViewModel();
            InitializeTalentAgencyData();
            InitializeCharacterData();

            //
            // instantiate and show the Main Window
            //
            _mainWindowView             = new MainWindowView();
            _mainWindowView.DataContext = _mainWindowViewModel;
            _mainWindowView.Show();
        }
コード例 #30
0
        private void NotificationMessageReceived(NotificationMessage msg)
        {
            if (msg.Notification == "UserLoginToSystem")
            {
                loginWindow.Hide();

                mainWindow = new MainWindowView();
                mainWindow.Show();

                trayIcon.InitialTrayIcon(mainWindow);
                trayIcon.InitialContextMenu();
            }
        }
コード例 #31
0
        private void LoginMethod()
        {
            Stocky.Proxies.EndPointDefinitions.IsInDebugMode = CurrentSession.IsInDebugMode;
            Proxies.AuthenticationClient AuthenticationClient = new Proxies.AuthenticationClient();
            try
            {
                ApplicationSettings _App = new ApplicationSettings();
                if (userobj != null)
                {
                    var result = AuthenticationClient.LoginUser(userobj.UserName, userobj.Password);

                    if (result.IsValidUser)
                    {
                        userobj = result.UserObject;

                        CurrentSession.CurrentUserObject = userobj;
                        Stocky.Data.Helpers.SetDataContextUser(userobj);
                        UserPreference UserPref = new UserPreference();
                        Stocky.Application.ApplicationSettings AppSettings = new Application.ApplicationSettings();

                        UserPref.Load();
                        AppSettings.LoadSettings();

                        App.Current.Dispatcher.BeginInvoke((Action) delegate
                        {
                            MainWindowView MW      = new MainWindowView();
                            App.Current.MainWindow = MW;
                            MW.Show();
                            Stocky.UI.Enviroment.CloseWindow("LoginView");
                        });
                    }
                    else
                    {
                        ErrorMEssage = "Incorrect Password!";
                    }
                }
            }
            catch (Exception E)
            {
                App.Current.Dispatcher.BeginInvoke((Action) delegate
                {
                    ExepionLogger.Logger.LogException(E);
                    ExepionLogger.Logger.Show(E);
                });
            }
            finally
            {
                AuthenticationClient.Close();
            }
        }
コード例 #32
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var splashScreen = new SplashScreenView();

            splashScreen.Show();

            await splashScreen.LoadDataAsync();

            var mainView = new MainWindowView();

            mainView.Show();

            splashScreen.Close();
        }