Inheritance: MetroWindow, IMainWindowView
示例#1
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();
                }
            }
        }
 public void Run()
 {
     RegisterViews();
     var vm = MakeAndRegisterMainViewModel();
     var view = new MainWindowView {ViewModel = vm};
     view.Show();
 }
示例#3
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();
        }
示例#4
0
        private void LoginCommandExecute()
        {
            AvtorisationProxy avtorisationProxy = new AvtorisationProxy();

            try
            {
                User                user                = avtorisationProxy.Avtorisation(_avtView.tbNickName.Text, _avtView.tbPassword.Password);
                MainWindowView      mainWindowView      = new MainWindowView();
                MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(mainWindowView, user);
                mainWindowView.DataContext = mainWindowViewModel;

                _avtView.Visibility = Visibility.Hidden;
                mainWindowView.ShowDialog();
                _avtView.Close();
            }
            catch (Exception ex)
            {
                MsgBox ms = new MsgBox(ex.Message);
                ms.ShowDialog();
            }

            //if (user != null)
            //{

            //}
            //else
            //{
            //    MsgBox ms = new MsgBox("Користувача з таким ім'ям не знайдено, або не вірний пароль");
            //    ms.ShowDialog();
            //}
        }
示例#5
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            MainWindowVM   viewModel  = new MainWindowVM();
            MainWindowView mainWindow = new MainWindowView(viewModel);

            mainWindow.Show();
        }
示例#6
0
        public static void Setup(TestContext context)
        {
            try
            {
                DeleteProductionFiles();
            }
            catch { }

            _winAppDriver.StartInfo.UseShellExecute = true;
            _winAppDriver.StartInfo.FileName        = _winAppDriverPath;
            _winAppDriver.StartInfo.Verb            = "runas";
            _winAppDriver.Start();

            //Desktop
            DesiredCapabilities _desktopCapabilities = new DesiredCapabilities();

            _desktopCapabilities.SetCapability("app", "Root");
            _desktopSession = new WindowsDriver <WindowsElement>(new Uri("http://127.0.0.1:4723"), _desktopCapabilities);
            _desktopSession.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(1.5));

            //Camtasia
            DesiredCapabilities _appCapabilities = new DesiredCapabilities();

            _appCapabilities.SetCapability("app", _editorPath);
            _camtasiaSession = new WindowsDriver <WindowsElement>(new Uri("http://127.0.0.1:4723"), _appCapabilities);
            _camtasiaSession.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(2.5));

            //Views
            _splashScreenView  = new SplashScreenView(_camtasiaSession);
            _welcomeWindowView = new WelcomeWindowView(_camtasiaSession);
            _mainWindowView    = new MainWindowView(_camtasiaSession);
            _recorderView      = new RecorderView(_desktopSession);
        }
示例#7
0
        private void OnAppStartup(object sender, StartupEventArgs e)
        {
            var viewModel = new MainWindowViewModel(true);
            var view      = new MainWindowView(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;
            }
        }
示例#9
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            try
            {
                RevitBridge revitBridge = new RevitBridge(commandData.Application);

                RevitHandler  revitHandler = new RevitHandler();
                ExternalEvent exEvent      = ExternalEvent.Create(revitHandler);

                MainWindowView firstControlView = new MainWindowView();
                MainWindowVM   vm = new MainWindowVM();
                firstControlView.ShowDialog();


                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return(Result.Failed);
            }
        }
示例#10
0
    public void Start(Action <IWindowViewModel>?mainWindowOptions = null)
    {
        var configuration = configurationBuilder.Build();

        containerBuilder.RegisterInstance(configuration).As <IConfiguration>();

        container = containerBuilder.Build();

        var csl = new AutofacServiceLocator(container);

        ServiceLocator.SetLocatorProvider(() => csl);

        startupFactory?.Invoke(container.Resolve <IShell>(), container.Resolve <IConfiguration>(), container)?.Start();

        appBuilder.Start(StartApplication, args);

        void StartApplication(Application app, string[] args)
        {
            var mainWindowViewModel = container.Resolve <MainWindowViewModel>();

            mainWindowOptions?.Invoke(mainWindowViewModel);

            var window = new MainWindowView()
            {
                DataContext = mainWindowViewModel,
            };

            app.Run(window);
        }
    }
示例#11
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            MainWindowView mainWindowView = new MainWindowView();

            mainWindowView.Show();
        }
示例#12
0
        public MainWindowViewModel(MainWindowView view)
        {
            IsAdsVisibility = false;
            _selectedTab    = 0;

            _view = view;

            _writersBattleFieldViewModel     = new WritersBattleFieldViewModel();
            _characterBuildControlViewModel  = new CharacterBuildViewModel();
            _storyFrameBuildControlViewModel = new StoryFrameBuildControlViewModel();
            _itemBuildControlViewModel       = new ItemBuildControlViewModel();

            _fileService = new SaveFileService();

            PluginLoad();
            InitializeViews();

            //TestBizModel.PrepareForTest();

            // WindowShowイベントに登録
            EventAggregator.ShowEventRised            += OnShowWindowEvent;
            EventAggregator.AdsLoaded                 += OnAdsLoaded;
            EventAggregator.DataReloaded              += OnDataReloaded;
            EventAggregator.ModelValueChanged         += OnModelChanged;
            EventAggregator.SaveSucceeded             += OnSaved;
            EventAggregator.TryClose                  += OnTryClose;
            EventAggregator.TrySave                   += OnTrySave;
            EventAggregator.TryOpen                   += OnTryOpen;
            EventAggregator.TryCreateNew              += OnTryCreateNew;
            EventAggregator.TryCreateNewPlus          += OnTryCreateNewPlus;
            EventAggregator.ChangeTabOccuredHandler   += OnChangeTabOccured;
            EventAggregator.FontSettingChangedHandler += EventAggregator_FontSettingChangedHandler;

            _view.GetTimelineControl().EventChangedRised += OnTimelineEventChanged;
        }
示例#13
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));
        }
示例#14
0
        public void ShowDialog()
        {
            var viewModelInterface = _mainWindowViewModelFactory();
            var view = new MainWindowView(viewModelInterface);

            view.ShowDialog();
        }
示例#15
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;
            }
        }
示例#16
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            MainWindowView vw = new MainWindowView();

            // MainWindowViewModel vm = new MainWindowViewModel();
            // vw.DataContext = vm;
            vw.Show();
        }
示例#17
0
 public MainWindowViewModel(MainWindowView mainWindowView, User user)
 {
     MainWindowViewProp = mainWindowView;
     UserProp           = user;
     Proxy = new MainProxy(this);
     Proxy.SubscribeToCallBack(user);
     MainWindowViewProp.Closed += _mainWindowView_Closed;
 }
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var view = new MainWindowView();

            view.ShowDialog();
        }
示例#19
0
        //private CaptureDirectShowV1 cap;

        public MainWindow()
        {
            InitializeComponent();

            MainWindowView view = MainWindowView.GetInstrance();

            DataContext = view;
        }
        protected override void OnStartup(StartupEventArgs e)
        {
            Window window = new MainWindowView();

            window.Show();

            base.OnStartup(e);
        }
示例#21
0
        public App()
        {
            var mw = new MainWindowView
            {
            };

            mw.Show();
        }
示例#22
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var locator = new ViewModelLocator();

            var window = new MainWindowView {
                DataContext = locator.GetMainWindowViewModel()
            }.ShowDialog();
        }
示例#23
0
        public void Play()
        {
            Control.Play();
            MainWindowView view = MainWindowView.GetInstrance();

            view.CameraStartStopButtonText = "Freeze";
            view.CameraStartStopButtonIcon = "/GemScopeWPF;component/Media/Icons/freeze.png";
        }
示例#24
0
        public void Stop()
        {
            Control.Stop();
            MainWindowView view = MainWindowView.GetInstrance();

            view.CameraStartStopButtonText = "Start";
            view.CameraStartStopButtonIcon = "/GemScopeWPF;component/Media/Icons/start-camera.png";
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            MainWindowPresenter mainWindowPresenter = new MainWindowPresenter();
            MainWindowView      mainWindowView      = new MainWindowView(mainWindowPresenter);

            mainWindowView.DataContext = mainWindowPresenter;

            mainWindowView.ShowDialog();
        }
示例#26
0
文件: App.xaml.cs 项目: alexxd0v/Calc
        public App()
        {
            MainWindowView win = new MainWindowView()
            {
                DataContext = new MainWindowViewModel()
            };

            win.Show();
        }
示例#27
0
        public void Stop()
        {
            //Decouple this using events and observer pattern
            webcam.Stop();
            MainWindowView view = MainWindowView.GetInstrance();

            view.CameraStartStopButtonText = "Start";
            WebCamOpen = false;
        }
示例#28
0
        void Application_Startup(object sender, StartupEventArgs e)
        {
            MainWindow = new MainWindowView();
            MainWindow.Show();

            var splash = new SplashWindowView();

            splash.Show();
        }
示例#29
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

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

            mainWindow.Show();
        }
示例#30
0
        /// <summary>Initializes a new instance of the <see cref="App" /> class.</summary>
        public App()
        {
            var mw = new MainWindowView
            {
                DataContext = new MainViewModel()
            };

            mw.Show();
        }
示例#31
0
 public void Show(UIApplication uiApp, ExternalEvent exEvent)
 {
     if (_mainWindow != null && _mainWindow == null)
     {
         return;
     }
     _mainWindow = new MainWindowView(uiApp, exEvent);
     _mainWindow.Show();
 }
示例#32
0
		public App()
		{
			var mw = new MainWindowView
			{
				DataContext = new MainViewModel()
			};

			mw.Show();

		}