コード例 #1
0
        public SplashScreen()
        {
            this.InitializeComponent();

            this.ViewModel   = new LoadingViewModel(App.DataSourceManager);
            this.DataContext = this.ViewModel;
        }
コード例 #2
0
 public void Initialize()
 {
     using (LoadingViewModel.Wait("Loading accounts..."))
         Accounts = _accountService.GetAccounts()
                    .Where(a => a.ShowOnMainScreen)
                    .ToArray();
 }
コード例 #3
0
        /// <summary>
        /// Открываем окно загрузки. Начало программы.
        /// </summary>
        private void InitialLoading()
        {
            var vm = new LoadingViewModel();

            var window = new AppWindow
            {
                MinWidth  = 320,
                MaxWidth  = 320 * 2,
                MinHeight = 400,
                MaxHeight = 400 * 2,

                Content = vm
            };

            // загружаем данные в Store
            var result = window.ShowDialog();

            // загрузили, что-то отредактировали и готовы сохранить
            if (true.Equals(result) ||
                vm.HasError ||
                AfterLoading())
            {
                if (OnSaving())
                {
                    App.Current.Shutdown();
                }
            }

            InitialLoading();
        }
コード例 #4
0
 public DynamicGridViewModel(IApplicationController applicationController)
 {
     ApplicationController = applicationController;
     LoadingViewModel      = new LoadingViewModel(applicationController);
     //this one a bit of a hack as loading/display controlled in code behind so set the vm as always loading
     SortLoadingViewModel = new LoadingViewModel(applicationController)
     {
         LoadingMessage = "Please Wait While Reloading Sorted Items", IsLoading = true
     };
     OnDoubleClick      = () => { };
     OnClick            = () => { };
     OnKeyDown          = () => { };
     PreviousPageButton = new XrmButtonViewModel("Prev", () =>
     {
         if (PreviousPageButton.Enabled)
         {
             --CurrentPage;
         }
     }, ApplicationController)
     {
         Enabled = false
     };
     NextPageButton = new XrmButtonViewModel("Next", () =>
     {
         if (NextPageButton.Enabled)
         {
             ++CurrentPage;
         }
     }, ApplicationController)
     {
         Enabled = false
     };
     MaxHeight  = 600;
     LoadDialog = (d) => { ApplicationController.UserMessage(string.Format("Error The {0} Method Has Not Been Set In This Context", nameof(LoadDialog))); };
 }
コード例 #5
0
 public DynamicGridViewModel(IApplicationController applicationController)
 {
     ApplicationController = applicationController;
     LoadingViewModel      = new LoadingViewModel(applicationController);
     OnDoubleClick         = () => { };
     OnClick            = () => { };
     OnKeyDown          = () => { };
     PreviousPageButton = new XrmButtonViewModel("Prev", () =>
     {
         if (PreviousPageButton.Enabled)
         {
             --CurrentPage;
         }
     }, ApplicationController)
     {
         Enabled = false
     };
     NextPageButton = new XrmButtonViewModel("Next", () =>
     {
         if (NextPageButton.Enabled)
         {
             ++CurrentPage;
         }
     }, ApplicationController)
     {
         Enabled = false
     };
     MaxHeight  = 600;
     LoadDialog = (d) => { ApplicationController.UserMessage(string.Format("Error The {0} Method Has Not Been Set In This Context", nameof(LoadDialog))); };
 }
コード例 #6
0
 public ShellViewModel(UserContext userContext, ServersContainerViewModel serversContainerViewModel, LoadingViewModel loadingViewModel, LoginViewModel logingViewModel, RegistrationViewModel registerViewModel, HeaderBarViewModel headerViewModel, SettingsTabViewModel settingsViewModel, P2PModalViewModel p2PModalViewModel, CyberSecReconnectViewModel cyberSectReconnectViewModel, CyberSecModalViewModel cyberSecModalViewModel, AppSelectViewModel appSelectViewModel, IPersistedSettings settings, P2PTrafficStatusObserver p2PTrafficStatusObserver, MapViewModel mapViewModel, TrayViewModel trayViewModel, ExpiredMembershipViewModel expiredMembershipViewModel, ExpiredMembershipObserver expiredMembershipObserver, SubHeaderStripViewModel subHeaderStripViewModel, HeaderBarViewModel headerBarViewModel, AppWindowManager windowManager)
 {
     this._userContext                 = userContext;
     this._headerViewModel             = headerViewModel;
     this._settingsViewModel           = settingsViewModel;
     this._p2PModalViewModel           = p2PModalViewModel;
     this._cyberSectReconnectViewModel = cyberSectReconnectViewModel;
     this._cyberSecModalViewModel      = cyberSecModalViewModel;
     this._appSelectViewModel          = appSelectViewModel;
     this._settings = settings;
     this._serversContainerViewModel = serversContainerViewModel;
     this._mapViewModel      = mapViewModel;
     this._loadingViewModel  = loadingViewModel;
     this._loginViewModel    = logingViewModel;
     this._registerViewModel = registerViewModel;
     this.< SubHeaderStrip > k__BackingField                 = subHeaderStripViewModel;
     this.< HeaderBar > k__BackingField                      = headerBarViewModel;
     p2PTrafficStatusObserver.P2PTrafficRerouted            += new EventHandler(this.OnP2PTrafficRerouted);
     this._expiredMembershipViewModel                        = expiredMembershipViewModel;
     expiredMembershipObserver.ForegroundNotificationNeeded += new EventHandler(this.OnForegroundNotificationNeeded);
     this._windowManager = windowManager;
     this._userContext.add_UserAuthenticated(new EventHandler <UserEventArgs>(this.OnUserAuthenticated));
     this._userContext.add_UserLoggedIn(new EventHandler <UserEventArgs>(this.OnUserLoggedIn));
     this._userContext.add_UserLoggedOut(new EventHandler <UserEventArgs>(this.OnUserLoggedOut));
     this.< Tray > k__BackingField   = trayViewModel;
     this.Tray.ActivateAppRequested += new EventHandler(this.TrayOnActivateAppRequested);
     base.get_Items().AddRange(new Screen[]
     {
         serversContainerViewModel,
         mapViewModel,
         settingsViewModel
     });
 }
コード例 #7
0
        //todo build in cancellation token
        public async Task OnNavigate()
        {
            Text.Clear();
            LoadMessage = new LoadingViewModel("Load message example", "10 Second delay");

            Text.Add("Often you need to execute a process that takes some time to complete.");
            await Task.Delay(1000);

            Text.Add("For example: Database or Hardware calls.");
            await Task.Delay(1000);

            Text.Add("During this period, you want to show some feedback to the user.");
            await Task.Delay(1000);

            Text.Add("Thats why we show a loading bar/message on the left.");
            await Task.Delay(1000);

            Text.Add("It's important to note, that we don't block the UI.");
            await Task.Delay(1000);

            Text.Add("So the user can use, all available functionality.");
            await Task.Delay(1000);

            Text.Add("For example our back button is clickable during this period.");
            await Task.Delay(4000);

            LoadMessage.IsLoading = false;
        }
コード例 #8
0
 internal static void Initialize(Action LoadDefaultView, Action LoadLoadingView)
 {
     Config          = new Settings();
     loadDefaultView = LoadDefaultView;
     loadLoadingView = LoadLoadingView;
     MatchViewModel  = new MatchDataViewModel();
     LoadingVM       = new LoadingViewModel();
 }
コード例 #9
0
 public void SetUp()
 {
     _loading                 = new GameObject();
     _loadingView             = _loading.AddComponent <LoadingView>();
     _loadingView.CanvasGroup = _loading.AddComponent <CanvasGroup>();
     _loadingViewModel        = new LoadingViewModel();
     _loadingView.SetModel(_loadingViewModel);
 }
コード例 #10
0
        public LoadingPage()
        {
            InitializeComponent();

            var userLoginService = Appcontiner.Resolve <IUserLoginService>();

            _viewModel = new LoadingViewModel(userLoginService);
        }
コード例 #11
0
        public void Init()
        {
            DataContext = new LoadingViewModel();

            var viewModel = (LoadingViewModel)DataContext;

            viewModel.DecryptFinished = new RelayCommand(true, OnDecryptFinished);
            viewModel.DecryptFilesAsync();
        }
コード例 #12
0
        public async Task InitializeAsync_shows_onboarding_view_if_user_has_not_seen_it()
        {
            _mockUserPreferences.ContainsKeyReturns(Constants.SHOWN_ONBOARDING, false);
            LoadingViewModel viewModel = CreateLoadingViewModel();

            await viewModel.InitializeAsync(null);

            _mockNavigationService.VerifyThatGoToLoginFlowWasCalled();
            _mockNavigationService.VerifyThatInsertAsRootWasNotCalled <LoginViewModel>();
        }
コード例 #13
0
        public LoadingView()
        {
            InitializeComponent();

            this.BindingContext = viewModel = new LoadingViewModel(this);

            viewModel.ContactsLoaded += (sender, e) =>
            {
                Application.Current.MainPage = new MainView();
            };
        }
コード例 #14
0
 protected FieldViewModelBase(string fieldName, string label, RecordEntryViewModelBase recordForm)
     : base(recordForm.ApplicationController)
 {
     LoadingViewModel     = new LoadingViewModel(recordForm.ApplicationController);
     RecordEntryViewModel = recordForm;
     Label                = label;
     FieldName            = fieldName;
     IsVisible            = true;
     IsRecordServiceField = true;
     DisplayLabel         = true;
 }
コード例 #15
0
        public ViewModelBaseExtension(LoadingViewModel loadingViewModel,
                                      INavigationService navigationService, Repo repository, IResponseHandler responseHandler, MessageBoxViewModel messageBoxViewModel)
        {
            LoadingViewModel    = loadingViewModel;
            MessageBoxViewModel = messageBoxViewModel;
            NavigationService   = navigationService;
            Repository          = repository;
            ResponseHandler     = responseHandler;
            WindowIsActive      = true;

            Messenger.Default.Register <MessageBoxViewModel>(this, param => UpperWindowClose());
        }
コード例 #16
0
 public JoinViewModel(string recordType, IRecordService recordService, IApplicationController controller, Action onPopulated, Action <JoinViewModel> remove, Action onConditionSelectedChanged)
     : base(controller)
 {
     OnConditionSelectedChanged = onConditionSelectedChanged;
     RecordType    = recordType;
     RecordService = recordService;
     //need to somehow have a relationship selections
     LinkSelections   = GetSelections();
     OnPopulated      = onPopulated;
     Remove           = new MyCommand(() => remove(this));
     LoadingViewModel = new LoadingViewModel(ApplicationController);
 }
コード例 #17
0
        public async Task InitializeAsync_shows_main_view_when_the_user_is_logged_in()
        {
            _mockUserPreferences.ContainsKeyReturns(Constants.SHOWN_ONBOARDING, true);
            _mockUserPreferences.ContainsKeyReturns(Constants.IS_USER_LOGGED_IN, true);
            _mockUserPreferences.GetReturns(Constants.IS_USER_LOGGED_IN, true);

            LoadingViewModel viewModel = CreateLoadingViewModel();

            await viewModel.InitializeAsync(null);

            _mockNavigationService.VerifyThatGoToMainFlowWasCalled();
        }
コード例 #18
0
        private async Task Initialize()
        {
            LoadingViewModel lvm = new LoadingViewModel();

            _progressMax = 0;
            _progress    = new Progress <ProgressMessage>((msg) => { Messenger.Default.Send <ProgressMessage>(msg); });

            Task apercuTask = CreationApercu(_progress);

            _dialogService.ShowDialog <LoadingDialog>(this, lvm);

            await apercuTask;
        }
コード例 #19
0
        public async Task InitializeAsync_shows_login_view_if_user_was_not_logged_in()
        {
            _mockUserPreferences.ContainsKeyReturns(Constants.SHOWN_ONBOARDING, true);
            _mockUserPreferences.ContainsKeyReturns(Constants.IS_USER_LOGGED_IN, false);
            _mockUserPreferences.GetReturns(Constants.IS_USER_LOGGED_IN, true);

            LoadingViewModel viewModel = CreateLoadingViewModel();

            await viewModel.InitializeAsync(null);

            _mockNavigationService.VerifyThatGoToLoginFlowWasCalled();
            _mockNavigationService.VerifyThatInsertAsRootWasCalled <LoginViewModel>();
        }
コード例 #20
0
        private async Task LoadingViewInitialized(object sender, EventArgs e)
        {
            LoadingViewModel loadingViewModel = (LoadingViewModel)DataContext;

            bool loadNewsExecuted = await loadingViewModel.LoadNews();

            if (loadNewsExecuted)
            {
                loadingViewModel.ChangeView();
            }
            else
            {
                Environment.Exit(0);
            }
        }
コード例 #21
0
        private void AlignmentTypeComboxBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            LoadingViewModel context = DataContext as LoadingViewModel;

            if (context != null)
            {
                if (context.LoadingAlignmentType == null)
                {
                    ComboBox box = sender as ComboBox;
                    if (box != null)
                    {
                        box.SelectedIndex = -1;
                    }
                }
            }
        }
コード例 #22
0
        protected FieldViewModelBase(string fieldName, string label, RecordEntryViewModelBase recordForm)
            : base(recordForm.ApplicationController)
        {
            LoadingViewModel = new LoadingViewModel(recordForm.ApplicationController);
            LoadingViewModel.LoadingMessage = null;
            RecordEntryViewModel            = recordForm;
            Label                = label;
            FieldName            = fieldName;
            IsVisible            = true;
            IsRecordServiceField = true;
            DisplayLabel         = true;

            if (FormService != null)
            {
                FormService.LoadPropertyChangedEvent(this);
            }
        }
コード例 #23
0
        /// <summary>
        /// Пытаемся сохранить
        /// </summary>
        /// <returns></returns>
        private bool WasSaved()
        {
            var vm     = new LoadingViewModel(false);
            var window = GetWindow(vm, 320, 400);

            // Closed by user
            if (window.ShowDialog() != true)
            {
                return(false);
            }

            if (vm.HasError)
            {
                return(WasSaved());
            }

            return(true);
        }
コード例 #24
0
        /// <summary>
        /// Сохраняем результаты
        /// </summary>
        /// <returns></returns>
        private bool OnSaving()
        {
            var vm = new LoadingViewModel(false);

            var window = new AppWindow
            {
                MinWidth  = 320,
                MaxWidth  = 320 * 2,
                MinHeight = 400,
                MaxHeight = 400 * 2,

                Content = vm
            };

            var result = window.ShowDialog();

            return(result == true || vm.HasError);
        }
コード例 #25
0
        private void Start()
        {
            var mainMenuViewModel = new MainMenuViewModel();
            var inGameViewModel   = new InGameViewModel();
            var loadingViewModel  = new LoadingViewModel();

            InstantiateViews(mainMenuViewModel, inGameViewModel, loadingViewModel);

            // TODO: these services should be unique, instantiate it in a previous step
            var gameRepository    = new GameRepository();
            var gameServerService = new GameServerService
                                    (
                new RestRestClientAdapter(new JsonUtilityAdapter()),
                gameRepository
                                    );
            var eventDispatcherService = new EventDispatcherService();
            var startGameUseCase       =
                new StartGameUseCase(gameServerService, gameRepository, new ConfigurationGameRepository(),
                                     eventDispatcherService);
            var startGameController = new StartGameController(mainMenuViewModel,
                                                              startGameUseCase
                                                              );
            var keyboardController = new KeyboardController(inGameViewModel,
                                                            new GuessLetterUseCase(
                                                                new CheckSolutionUseCase(
                                                                    gameServerService,
                                                                    gameRepository,
                                                                    eventDispatcherService
                                                                    ),
                                                                gameRepository,
                                                                gameServerService,
                                                                eventDispatcherService
                                                                )
                                                            );
            var restartGameController =
                new RestartGameController(inGameViewModel,
                                          new RestartGameUseCase(startGameUseCase, eventDispatcherService));

            var updateWordPresenter = new InGamePresenter(inGameViewModel, eventDispatcherService);
            var mainMenuPresenter   = new MainMenuPresenter(mainMenuViewModel, eventDispatcherService);
            var loadingPresenter    = new LoadingPresenter(loadingViewModel, eventDispatcherService);
        }
コード例 #26
0
        private async Task Initialize()
        {
            LoadingViewModel lvm = new LoadingViewModel();

            _progressMax = 0;
            _progress    = new Progress <ProgressMessage>((msg) => { Messenger.Default.Send <ProgressMessage>(msg); });

            Task apercuTask = CreationApercu(_progress);

            if (ListeDemande_Absence.Count != 1)
            {
                MailEnabled = false;
            }
            else
            {
                MailEnabled = true;
            }

            _dialogService.ShowDialog <LoadingDialog>(this, lvm);

            await apercuTask;
        }
コード例 #27
0
        private void InstantiateViews(
            MainMenuViewModel mainMenuViewModel,
            InGameViewModel inGameViewModel,
            LoadingViewModel loadingViewModel
            )
        {
            var mainMenuViewInstance = Instantiate(_mainMenuViewPrefab); // TODO: extract to a service

            mainMenuViewInstance.SetModel(mainMenuViewModel);

            var inGameViewInstance = Instantiate(_inGameViewPrefab); // TODO: extract to a service

            inGameViewInstance.SetModel(inGameViewModel);
            inGameViewInstance
            .GetComponentInChildren <KeyboardView>()
            .SetModel(inGameViewModel);     // TODO: consider move this responsability to the parent view
            inGameViewInstance
            .GetComponentInChildren <GallowView>()
            .SetModel(inGameViewModel);                                // TODO: consider move this responsability to the parent view

            var loadingViewInstance = Instantiate(_loadingViewPrefab); // TODO: extract to a service

            loadingViewInstance.SetModel(loadingViewModel);
        }
コード例 #28
0
 protected TabAreaViewModelBase(IApplicationController controller)
     : base(controller)
 {
     LoadingViewModel      = new LoadingViewModel(controller);
     CloseOtherTabsCommand = new MyCommand(() =>
     {
         foreach (var item in ApplicationController.GetObjects().ToArray())
         {
             if (item != this)
             {
                 if (item is TabAreaViewModelBase)
                 {
                     ((TabAreaViewModelBase)item).TabCloseCommand.Execute();
                 }
                 else
                 {
                     ApplicationController.Remove(item);
                 }
             }
         }
     });
     CloseAllTabsCommand = new MyCommand(() =>
     {
         foreach (var item in ApplicationController.GetObjects().ToArray())
         {
             if (item is TabAreaViewModelBase)
             {
                 ((TabAreaViewModelBase)item).TabCloseCommand.Execute();
             }
             else
             {
                 ApplicationController.Remove(item);
             }
         }
     });
 }
コード例 #29
0
ファイル: LoadingPage.xaml.cs プロジェクト: alonibh/driver
 public LoadingPage()
 {
     InitializeComponent();
     BindingContext = new LoadingViewModel();
 }
コード例 #30
0
 public LoadingView()
 {
     DataContext = new LoadingViewModel();
     InitializeComponent();
 }