private async Task LoadApplication() { string error = null; try { // Manage here any long time initialization (DB, Localisation, etc...) //var taskToDo = LocalizationService.InitializeAsync(); //var taskToWait = Task.Delay(3000); //await Task.WhenAll(taskToDo, taskToWait); StatusLabel = "Chargement du thème..."; await ThemeHelper.InitTheme(); await Task.Delay(1000); //Fake/Dev init StatusLabel = "Chargement de la BDD..."; await Task.Delay(1000); StatusLabel = "Chargement de la langue..."; await Task.Delay(1000); StatusLabel = "Chargement de XXX..."; await Task.Delay(1000); StatusLabel = "Chargement de YYY..."; await Task.Delay(1000); StatusLabel = "Lancement de l'application..."; await Task.Delay(1000); // Manage startup navigation logic (ConfigPage or LoginProcess or HomePage or whatever...) string nextPage; //if (SettingsService.IsUserLogged()) //{ nextPage = $"/{nameof(MDPage)}/{nameof(NavigationPage)}/{nameof(HomePage)}"; //} //else //{ // mainPage = $"/{nameof(LoginPage)}"; //} await Device.InvokeOnMainThreadAsync(async() => await NavigationService.NavigateAsync(nextPage)); } catch (Exception ex) { error = this["Msg_RedToast_Error_Unknown"]; Logger.Write(ex); } finally { if (!string.IsNullOrWhiteSpace(error)) { DialogsService?.Toast(error); HasFailedOnce = true; } } }
//public ICommand LoadCommand { get; } #endregion #region Methods private void LoadDatas() { try { //Load data for this ViewModel (fake) Themes = new ObservableCollection <string>(new List <string>() { "Acrylic", "AcrylicBlur", "AcrylicDarkBlur", "Dark", "Light" }); TestValue = 2; SelectedTheme = Enum.GetName(typeof(AppTheme), ThemeHelper.GetCurrentTheme()); } catch (Exception ex) { DialogsService?.Toast(this["Msg_RedToast_Error_Unknown"]); Logger.Write(ex); } finally { } }
private async Task LoadDatas() { try { //Load data for this ViewModel //Get User display UserDisplayName = "Prénom Nom"; //SettingsService.UserPrenom + " " + SettingsService.UserNom; UserLogin = "******"; //SettingsService.UserEmail; //Create NavigationMenu MenuItems = new List <MenuItemModel> { new MenuItemModel { Title = this["HomePage_Title"], ItemImageSource = "ic_home.png", NavigationPath = $"{nameof(NavigationPage)}/{nameof(HomePage)}" }, //Add any new MenuItem in MasterDetail menu //new MenuItemModel //{ // Title = this["NewPage_Title"], // ItemImageSource = "newpage_icon.png", // NavigationPath = $"{nameof(NavigationPage)}/{nameof(NewPage)}" //}, }; #if DEBUG MenuItems.Add(new MenuItemModel { Title = this["Debug_BottomTabsPage_Title"], ItemImageSource = "ic_bug_report.png", NavigationPath = $"{nameof(NavigationPage)}/{nameof(Debug_BottomTabsPage)}?selectedTab={nameof(Debug_ImagesView)}" }); #endif //await Device.InvokeOnMainThreadAsync(notificationService.RegisterAsync); //MessagingCenter.Unsubscribe<object, string>(this, "NotifURL"); //MessagingCenter.Subscribe<object, string>(this, "NotifURL", async (sender, url) => //{ // await NavigationService.NavigateAsync(url); //}); //if (SelectedMenuItem == null) // SelectedMenuItem = MenuItems.Count > 0 ? MenuItems[0] : null; } catch (Exception ex) { DialogsService?.Toast(this["Msg_RedToast_Error_Unknown"]); Logger.Write(ex); } finally { } }
private void mnuAddImage_Click(object sender, EventArgs e) { Bitmap newImage = DialogsService.getImageFromDisk(); if (newImage != null) { pastingImage = newImage; } }
public UserDetailViewModel(NavigationService navigationService, IUsersService usersService, DialogsService dialogsService, SnackbarService snackbarService) { _navigationService = navigationService; _usersService = usersService; _dialogsService = dialogsService; _snackbarService = snackbarService; CancelCommand = new RelayCommand(() => Cancel()); AddCommand = new RelayCommand(() => Add()); }
public async Task FillAsync() { DialogsService = _ioc.Resolve <IDialogsService>(); SendingService = _ioc.Resolve <ISendingService>(); ContactsService = _ioc.Resolve <IContactsService>(); ReceivingService = _ioc.Resolve <IReceivingService>(); ReceivingService.OnUpdateDialogs += ReceivingService_OnUpdateDialogs; ReceivingService.OnUpdateContacts += ReceivingService_OnUpdateContacts; await ContactsService.FillContacts(); await DialogsService.FillDialogList(); }
public void Inject( BackgroundService service, IUiService uis, ItemsService itemsService, DialogsService dialogs, StateService state) { _service = service; _uiService = uis; _itemsService = itemsService; _dialogs = dialogs; _state = state; }
private async Task LoadDatas() { try { //Load data for this ViewModel (fake) await Task.Delay(1000); Property1 = "Toto"; await Task.Delay(1000); } catch (Exception ex) { DialogsService?.Toast(this["Msg_RedToast_Error_Unknown"]); Logger.Write(ex); } finally { } }
//public ICommand MenuNavigateCommand { get; } #endregion #region Methods private async Task LogoutUser() { try { if (await DialogsService?.ConfirmAsync(this["Msg_Confirm_Disconnect"], this["Msg_Confirm_Title"], this["Msg_Confirm_Ok"], this["Msg_Confirm_Cancel"])) { DialogsService?.Loading(this["Msg_Loading_Disconnecting"]); await Task.Delay(500); //await DataService.ClearUserDataAsync(); SettingsService?.Clear(); //_notificationService.Unregister(); Logger.Write("LogoutUser", $"Day({DateTime.Now.ToString("yyyy_MM_dd")})"); await NavigationService.NavigateAsync($"{nameof(App)}:///{nameof(StartupPage)}"); } } catch (Exception ex) { Logger.Write(ex); } }
private void ReceivingService_OnUpdateDialogs() { DialogsService.FillDialogList(); }
public void CopyFoto() { var UNIUs = SelectByPattern(); DialogsService.SelectPhotoDialog(UNIUs, DUFilesDir); }
public void Inject(BackgroundService service, DialogsService dialogs) { _service = service; _dialogs = dialogs; }