Пример #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));
        }
 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
        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();
        }
        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
        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
        /// <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
        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
		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
        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);
        }
        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();
        }