public ShowContentViewModel(IODataClient oDataClient, IUserDialogs userDialogs, INewsService newsService) { _oDataClient = oDataClient; _userDialogs = userDialogs; _newsService = newsService; Like = new BitDelegateCommand(async() => { using (_userDialogs.Loading(ConstantStrings.Loading)) { bool likeStatus = Content.YourLike; Content.YourLike = await newsService.LikeNews(Content.NewsID); if (Content.YourLike == false && likeStatus == true) { Content.Likes--; } else if (Content.YourLike == true && likeStatus == false) { Content.Likes++; } } }); ShareCommand = new BitDelegateCommand(async() => { await Share.RequestAsync(new ShareTextRequest { Text = NewsService.StripHTML(Content.Text), Title = Content.Title }); }); }
public CalculatorViewModel() { DoSumCommand = new BitDelegateCommand(DoSum); DoSubtractionCommand = new BitDelegateCommand(DoSubtraction); DoMultiplicationCommand = new BitDelegateCommand(DoMultiplication); DoDivisionCommand = new BitDelegateCommand(DoDivision); }
public OpenImagePopupViewModel() { GoBack = new BitDelegateCommand(async() => { await NavigationService.GoBackAsync(); }); }
public TestViewModel() { CloseCommand = new BitDelegateCommand(Close); ThrowExceptionCommand = new BitDelegateCommand(ThrowException); IncreaseStepsCountCommand = new BitDelegateCommand(IncreaseSteps); TestSignalrCommand = new BitDelegateCommand(TestSignalr); }
public TestViewModel(IPopupNavigationService popupNavigationService) { Close = new BitDelegateCommand(async() => { await popupNavigationService.PopAsync(); }); }
public ContactUsViewModel() { WhatsApp = new BitDelegateCommand(async() => { Device.OpenUri(new System.Uri("https://api.whatsapp.com/send?phone=989036193862")); }); Telegram = new BitDelegateCommand(async() => { Device.OpenUri(new System.Uri("https://t.me/mo-kml")); }); Instagram = new BitDelegateCommand(async() => { Device.OpenUri(new System.Uri("https://www.instagram.com/mo_kml/")); }); Call = new BitDelegateCommand(async() => { Device.OpenUri(new System.Uri("tel:038773729")); }); Route = new BitDelegateCommand(async() => { Device.OpenUri(new System.Uri("geo:35.71022,51.4939886")); }); }
public MenuViewModel(ISecurityService securityService, IEventAggregator eventAggregator) { GoToPage = new BitDelegateCommand<string>(async (page) => { eventAggregator.GetEvent<ToggleMenuEvent>().Publish(Menu); await NavigationService.NavigateAsync(page); }); Logout = new BitDelegateCommand(async () => { eventAggregator.GetEvent<ToggleMenuEvent>().Publish(Menu); await securityService.Logout(); await NavigationService.NavigateAsync($"/{nameof(NavigationPage)}/{nameof(LoginView)}"); }); GoBack = new BitDelegateCommand(async () => { eventAggregator.GetEvent<ToggleMenuEvent>().Publish(Menu); await NavigationService.GoBackAsync(); }); }
public CustomersViewModel() { LoadMoreCommand = new BitDelegateCommand(LoadMore); AddCommand = new BitDelegateCommand(Save); EditCommand = new BitDelegateCommand <CustomerDto>(Save); DeleteCommand = new BitDelegateCommand <CustomerDto>(Delete); }
public MenuViewModel() { AddNewGroupCommand = new BitDelegateCommand(AddNewGroupAsync, () => !string.IsNullOrEmpty(NewGroupName)); AddNewGroupCommand.ObservesProperty(() => NewGroupName); CancelAddNewGroupCommand = new BitDelegateCommand(CancelAddNewGroupAsync); ShowNewGroupStackCommand = new BitDelegateCommand(async() => { NewGroupName = Strings.NewGroupName; }); }
public EvaluationRequestListViewModel(IEvlRequestService evlRequestService, IUserDialogs userDialogs, IPageDialogService dialogService, IEventAggregator eventAggregator) { _evlRequestService = evlRequestService; _userDialogs = userDialogs; _dialogService = dialogService; _eventAggregator = eventAggregator; ShowRequestProgress = new BitDelegateCommand <EvlRequestListItemSource>(async(request) => { await NavigationService.NavigateAsync(nameof(EvlRequestProgressView), new NavigationParameters { { nameof(EvlRequestListItemSource), request } }); }); OpenInquiryBox = new BitDelegateCommand(async() => { eventAggregator.GetEvent <OpenInquiryPopupEvent>().Publish(new OpenInquiryPopupEvent()); }); Inquiry = new BitDelegateCommand(async() => { inquiryCancellationTokenSource?.Cancel(); inquiryCancellationTokenSource = new CancellationTokenSource(); using (_userDialogs.Loading(ConstantStrings.Loading, cancelText: ConstantStrings.Loading_Cancel, onCancel: inquiryCancellationTokenSource.Cancel)) { if (string.IsNullOrEmpty(DocumentNumber) || !Requests.Any(r => r.Code == int.Parse(DocumentNumber))) { await dialogService.DisplayAlertAsync(ConstantStrings.Error, ConstantStrings.DocumentNumberIsInvalid, ConstantStrings.Ok); DocumentNumber = null; return; } EvlRequestDto requestDto = await evlRequestService.SearchByCode(int.Parse(DocumentNumber)); if (requestDto == null) { await dialogService.DisplayAlertAsync(ConstantStrings.Error, ConstantStrings.RequestDosentExist, ConstantStrings.Ok); DocumentNumber = null; return; } else { DocumentNumber = null; eventAggregator.GetEvent <OpenInquiryPopupEvent>().Publish(new OpenInquiryPopupEvent()); INavigationParameters parameter = new NavigationParameters(); parameter.Add(nameof(EvlRequestListItemSource), new EvlRequestListItemSource { Code = requestDto.Code, RequestId = requestDto.Id, RequestTypeName = EnumHelper <EvlRequestType> .GetDisplayValue(requestDto.EvlRequestType) }); await NavigationService.NavigateAsync(nameof(EvlRequestProgressView), parameter); } } }); }
public EvaluationRequestLostDetailViewModel( IUserDialogs userDialogs, ILicenseHelper licenseHelper, ISanaapAppTranslateService translateService, IEvlRequestValidator evlRequestValidator, IInitialDataService initialDataService, IPageDialogService dialogService) { _initialDataService = initialDataService; _userDialogs = userDialogs; _licenseHelper = licenseHelper; GoBack = new BitDelegateCommand(async() => { await NavigationService.GoBackAsync(); }); GoToNextLevel = new BitDelegateCommand(async() => { requestCancellationTokenSource?.Cancel(); requestCancellationTokenSource = new CancellationTokenSource(); using (userDialogs.Loading(ConstantStrings.Loading, cancelText: ConstantStrings.Loading_Cancel, onCancel: requestCancellationTokenSource.Cancel)) { if (SelectedCar == null) { await dialogService.DisplayAlertAsync(ConstantStrings.Error, ConstantStrings.CarIsNull, ConstantStrings.Ok); return; } if (SelectedAlphabet == null) { await dialogService.DisplayAlertAsync(ConstantStrings.Error, ConstantStrings.NumberPlateIsNotValid, ConstantStrings.Ok); return; } Request.LostCarId = SelectedCar.PrmID; LostLicense.Alphabet = SelectedAlphabet.Name; if (licenseHelper.ConvertToPlateNumber(LostLicense, out string licensePlate)) { Request.LostPlateNumber = licensePlate; } else { return; } if (!evlRequestValidator.IsLostDetailValid(Request, out string message)) { await dialogService.DisplayAlertAsync(string.Empty, translateService.Translate(message), ConstantStrings.Ok); return; } await NavigationService.NavigateAsync(nameof(EvaluationRequestDescriptionView), new NavigationParameters { { nameof(Request), Request } }); } }); }
public EvlRequestWaitViewModel( IODataClient odataClient, IEvlRequestService evlRequestService, IDeviceService deviceService, IODataClient oDataClient, HttpClient httpClient, IDateTimeUtils dateTimeUtils, IInitialDataService initialDataService, IPageDialogService pageDialogService) { _odataClient = odataClient; _evlRequestService = evlRequestService; _pageDialogService = pageDialogService; _initialDataService = initialDataService; _httpClient = httpClient; _dateTimeUtils = dateTimeUtils; GoToMain = new BitDelegateCommand(async() => { await NavigationService.NavigateAsync($"/{nameof(NavigationPage)}/{nameof(MainMenuView)}"); }); Call = new BitDelegateCommand(async() => { deviceService.OpenUri(new Uri("tel://" + ExpertMobileNo + "")); }); //RatingValueChanged = new BitDelegateCommand<int>(async (value) => //{ // await _pageDialogService.DisplayAlertAsync("", "RatingValueChanged : " + value.ToString(), ErrorMessages.Ok); //}); }
public EvaluationRequestMapViewModel(IUserDialogs userDialogs, IPageDialogService dialogService) { _userDialogs = userDialogs; _dialogService = dialogService; UpdateLocation = new BitDelegateCommand <Xamarin.Forms.GoogleMaps.Map>(async(map) => { Position centerPosition = map.VisibleRegion.Center; Request.Latitude = centerPosition.Latitude; Request.Longitude = centerPosition.Longitude; //Geocoder geoCoder = new Geocoder(); //Request.Address = (await geoCoder.GetAddressesForPositionAsync(centerPosition)).FirstOrDefault(); await NavigationService.NavigateAsync(nameof(EvaluationRequestFilesView), new NavigationParameters { { nameof(Request), Request } }); }); GoBack = new BitDelegateCommand(async() => { await NavigationService.GoBackAsync(); }); }
public CommentAnswerPopupViewModel() { ClosePopup = new BitDelegateCommand(async() => { await NavigationService.GoBackAsync(); }); }
public InsuranceListPopupViewModel(IEventAggregator eventAggregator, IPolicyService policyService, IUserDialogs userDialogs) { _policyService = policyService; _userDialogs = userDialogs; EvlRequestItemSource _request = new EvlRequestItemSource(); SubscriptionToken = eventAggregator.GetEvent <InsuranceEvent>().SubscribeAsync(async(request) => { _request = request; insuranceCancellationTokenSource?.Cancel(); insuranceCancellationTokenSource = new CancellationTokenSource(); using (_userDialogs.Loading(ConstantStrings.Loading, cancelText: ConstantStrings.Loading_Cancel, onCancel: insuranceCancellationTokenSource.Cancel)) { await loadInsurances(); } }, keepSubscriberReferenceAlive: true, threadOption: ThreadOption.UIThread); SelectPolicy = new BitDelegateCommand <PolicyItemSource>(async(policy) => { eventAggregator.GetEvent <OpenInsurancePopupEvent>().Publish(new OpenInsurancePopupEvent()); //await NavigationService.NavigateAsync(nameof(EvaluationRequestView), new NavigationParameters { // { "Insurance",policy}, // {nameof(EvlRequestItemSource),_request } //}); }); }
public MainViewModel() { SyncCommand = new BitDelegateCommand(Sync); SendHttpRequestCommand = new BitDelegateCommand(SendHttpRequest); SendODataRequestCommand = new BitDelegateCommand(SendODataRequest); LogoutCommand = new BitDelegateCommand(Logout); ShowPopupCommand = new BitDelegateCommand(ShowPopup); }
public LoginViewModel() { LoginUsingCredentialsCommand = new BitDelegateCommand(LoginUsingCredentials, () => !string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password)); LoginUsingCredentialsCommand.ObservesProperty(() => UserName); LoginUsingCredentialsCommand.ObservesProperty(() => Password); LoginUsingBrowserCommand = new BitDelegateCommand(LoginUsingBrowser); LoginUsingGooglePlusCommand = new BitDelegateCommand(LoginUsingGooglePlus); SkipCommand = new BitDelegateCommand(Skip); }
public MenuViewModel() { BeginAddNewGroupCommand = new BitDelegateCommand(BeginAddNewGroup); AddNewGroupCommand = new BitDelegateCommand(AddNewGroupAsync, () => !string.IsNullOrEmpty(NewGroupTitle)); AddNewGroupCommand.ObservesProperty(() => NewGroupTitle); DeleteGroupCommand = new BitDelegateCommand <ToDoGroupDto>(DeleteGroupAsync); EditGroupNameCommand = new BitDelegateCommand <ToDoGroupDto>(EditGroupNameAsync); CancelAddNewGroupCommand = new BitDelegateCommand(CancelAddNewGroupAsync); OpenToDoItemsCommand = new BitDelegateCommand <object>(OpenToDoItems); }
public SampleViewModel(IDateHelper dateHelper, IUserDialogs userDialogs) { _dateHelper = dateHelper; registerCancellationTokenSource?.Cancel(); registerCancellationTokenSource = new CancellationTokenSource(); Select = new BitDelegateCommand(async() => { await NavigationService.NavigateAsync(nameof(EvaluationRequestExpertRankView)); }); //Contents = new ObservableCollection<Test>( // new List<Test> // { // new Test{ Image=ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Title="مغفول ماندن بیمه رانندگان طی چند سال اخیر", Text="مدیرعامل اتحادیه تاکسیرانی های شهری کشور گفت : متاسفانه موضوع بسیار مهم تامین اجتماعی رانندگان طی چند سال اخیر مغفول مانده، در صورتی ",Likes=125,YourLike=1,Date="1397/10/23"}, // new Test{ Image=ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Title="مغفول ماندن بیمه رانندگان طی چند سال اخیر", Text="مدیرعامل اتحادیه تاکسیرانی های شهری کشور گفت : متاسفانه موضوع بسیار مهم تامین اجتماعی رانندگان طی چند سال اخیر مغفول مانده، در صورتی ",Likes=225,YourLike=0,Date="1397/10/23"}, // new Test{ Image=ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Title="مغفول ماندن بیمه رانندگان طی چند سال اخیر", Text="مدیرعامل اتحادیه تاکسیرانی های شهری کشور گفت : متاسفانه موضوع بسیار مهم تامین اجتماعی رانندگان طی چند سال اخیر مغفول مانده، در صورتی ",Likes=345,YourLike=0,Date="1397/10/23"}, // new Test{ Image=ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Title="مغفول ماندن بیمه رانندگان طی چند سال اخیر", Text="مدیرعامل اتحادیه تاکسیرانی های شهری کشور گفت : متاسفانه موضوع بسیار مهم تامین اجتماعی رانندگان طی چند سال اخیر مغفول مانده، در صورتی ",Likes=120,YourLike=1,Date="1397/10/23"}, // new Test{ Image=ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Title="مغفول ماندن بیمه رانندگان طی چند سال اخیر", Text="مدیرعامل اتحادیه تاکسیرانی های شهری کشور گفت : متاسفانه موضوع بسیار مهم تامین اجتماعی رانندگان طی چند سال اخیر مغفول مانده، در صورتی ",Likes=54,YourLike=0 ,Date="1397/10/23"} // } // ); //Image = ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Contents = new ObservableCollection <Test>( new List <Test> { new Test { Image = ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Likes = 157, Date = "1397/11/17", Text = "متنی برای آزمایش میزان درستی قرار گیری اشیاء در کنار یکدیگر این یک متن آزمایشی است و این موضوع صرفا جهت طولانی تر شدن متن بوده و دلیل دیگری ندارد", Title = "عنوان آزمایشی برای برسی چگونگی قرارگیری اشیاء در کنار یکدیگر", YourLike = 1 }, new Test { Image = ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Likes = 137, Date = "1397/11/17", Text = "متنی برای آزمایش میزان درستی قرار گیری اشیاء در کنار یکدیگر این یک متن آزمایشی است و این موضوع صرفا جهت طولانی تر شدن متن بوده و دلیل دیگری ندارد", Title = "عنوان آزمایشی برای برسی چگونگی قرارگیری اشیاء در کنار یکدیگر", YourLike = 0 }, new Test { Image = ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Likes = 155, Date = "1397/11/17", Text = "متنی برای آزمایش میزان درستی قرار گیری اشیاء در کنار یکدیگر این یک متن آزمایشی است و این موضوع صرفا جهت طولانی تر شدن متن بوده و دلیل دیگری ندارد", Title = "عنوان آزمایشی برای برسی چگونگی قرارگیری اشیاء در کنار یکدیگر", YourLike = 1 }, new Test { Image = ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Likes = 457, Date = "1397/11/17", Text = "متنی برای آزمایش میزان درستی قرار گیری اشیاء در کنار یکدیگر این یک متن آزمایشی است و این موضوع صرفا جهت طولانی تر شدن متن بوده و دلیل دیگری ندارد", Title = "عنوان آزمایشی برای برسی چگونگی قرارگیری اشیاء در کنار یکدیگر", YourLike = 1 }, new Test { Image = ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Likes = 127, Date = "1397/11/17", Text = "متنی برای آزمایش میزان درستی قرار گیری اشیاء در کنار یکدیگر این یک متن آزمایشی است و این موضوع صرفا جهت طولانی تر شدن متن بوده و دلیل دیگری ندارد", Title = "عنوان آزمایشی برای برسی چگونگی قرارگیری اشیاء در کنار یکدیگر", YourLike = 0 }, new Test { Image = ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Likes = 156, Date = "1397/11/17", Text = "متنی برای آزمایش میزان درستی قرار گیری اشیاء در کنار یکدیگر این یک متن آزمایشی است و این موضوع صرفا جهت طولانی تر شدن متن بوده و دلیل دیگری ندارد", Title = "عنوان آزمایشی برای برسی چگونگی قرارگیری اشیاء در کنار یکدیگر", YourLike = 0 }, new Test { Image = ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Likes = 257, Date = "1397/11/17", Text = "متنی برای آزمایش میزان درستی قرار گیری اشیاء در کنار یکدیگر این یک متن آزمایشی است و این موضوع صرفا جهت طولانی تر شدن متن بوده و دلیل دیگری ندارد", Title = "عنوان آزمایشی برای برسی چگونگی قرارگیری اشیاء در کنار یکدیگر", YourLike = 1 }, new Test { Image = ImageSource.FromUri(new Uri("https://img.game.co.uk/ml2/7/3/0/3/730331_scr3_a.png")), Likes = 187, Date = "1397/11/17", Text = "متنی برای آزمایش میزان درستی قرار گیری اشیاء در کنار یکدیگر این یک متن آزمایشی است و این موضوع صرفا جهت طولانی تر شدن متن بوده و دلیل دیگری ندارد", Title = "عنوان آزمایشی برای برسی چگونگی قرارگیری اشیاء در کنار یکدیگر", YourLike = 1 }, }); Image = "https://raw.githubusercontent.com/recurser/exif-orientation-examples/master/Landscape_3.jpg"; }
public MainViewModel() { SyncCommand = new BitDelegateCommand(Sync); SendHttpRequestCommand = new BitDelegateCommand(SendHttpRequest); SendRefitRequestCommand = new BitDelegateCommand(SendRefitRequest); SendODataRequestCommand = new BitDelegateCommand(SendODataRequest); SendODataBatchRequestCommand = new BitDelegateCommand(SendODataBatchRequest); LogoutCommand = new BitDelegateCommand(Logout); ShowPopupCommand = new BitDelegateCommand(ShowPopup); OpenConsoleCommand = new BitDelegateCommand(OpenConsole); }
public EvlRequestProgressViewModel(IEvlRequestService evlRequestService, IUserDialogs userDialogs, IDateHelper dateHelper) { _evlRequestService = evlRequestService; _userDialogs = userDialogs; _dateHelper = dateHelper; ClosePopup = new BitDelegateCommand(async() => { await NavigationService.GoBackAsync(); }); }
public MainMenuViewModel( ISecurityService securityService, IDeviceService deviceService, IUserDialogs userDialogs, HttpClient httpClient, IInitialDataService initialDataService) { _userDialogs = userDialogs; _httpClient = httpClient; _initialDataService = initialDataService; GoToEvalutionRequestMenu = new BitDelegateCommand(async() => { await NavigationService.NavigateAsync(nameof(EvaluationRequestMenuView)); }); }
public EvaluationRequestExpertRankViewModel(IEvlRequestService requestService) { SubmitRank = new BitDelegateCommand(async() => { if (Request.RankValue != 0 || !string.IsNullOrEmpty(Request.RankDescription)) { await requestService.UpdateRank(Request); } await NavigationService.NavigateAsync($"/{nameof(NavigationPage)}/{nameof(MainMenuView)}"); }); }
public App(IPlatformInitializer initializer) : base(initializer) { InitializeComponent(); OpenMenu = new BitDelegateCommand <IconButton>(async(button) => { AbsoluteLayout menu = ((AbsoluteLayout)button.BindingContext); ToggleMenu(menu); }); }
public LoginViewModel(INavigationService navigationService, IODataClient oDataClient, HttpClient httpClient, IPageDialogService pageDialogService, ISecurityService securityService) { LoginUsingCredentionals = new BitDelegateCommand(async() => { try { await securityService.LoginWithCredentials(UserName, Password, client_id: "TestResOwner", client_secret: "secret"); await navigationService.NavigateAsync("/Nav/Main"); } catch { await pageDialogService.DisplayAlertAsync("Login failed", "Login failed", "Ok"); throw; } }, () => !string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password)); LoginUsingCredentionals.ObservesProperty(() => UserName); LoginUsingCredentionals.ObservesProperty(() => Password); LoginUsingGooglePlus = new BitDelegateCommand(async() => { try { await securityService.Login(new { SignInType = "Google" }); await navigationService.NavigateAsync("/Nav/Main"); } catch { await pageDialogService.DisplayAlertAsync("Login failed", "Login failed", "Ok"); throw; } }); LoginUsingBrowser = new BitDelegateCommand(async() => { try { await securityService.Login(); await navigationService.NavigateAsync("/Nav/Main"); } catch { await pageDialogService.DisplayAlertAsync("Login failed", "Login failed", "Ok"); throw; } }); Skip = new BitDelegateCommand(async() => { await navigationService.NavigateAsync("/Nav/Main"); }); }
public ContentListViewModel(IODataClient oDataClient, IUserDialogs userDialogs, INewsService newsService, IInitialDataService initialDataService, IEventAggregator eventAggregator, IPageDialogService dialogService) { _oDataClient = oDataClient; _userDialogs = userDialogs; _newsService = newsService; _initialDataService = initialDataService; ShowContent = new BitDelegateCommand <NewsItemSource>(async(content) => { INavigationParameters parameters = new NavigationParameters(); parameters.Add("NewsId", content.NewsID); await NavigationService.NavigateAsync(nameof(ShowContentView), parameters); }); FilterContent = new BitDelegateCommand(async() => { FilterDto.Month = SelectedMonth?.Number; FilterDto.Year = SelectedYear?.Number; if (FilterDto.Month != null || FilterDto.Year != null) { if (FilterDto.Month == null || FilterDto.Year == null) { await dialogService.DisplayAlertAsync(ConstantStrings.Error, ConstantStrings.NewsFilterNotValid, ConstantStrings.Ok); SelectedYear = null; SelectedMonth = null; return; } } contentCancellationTokenSource?.Cancel(); contentCancellationTokenSource = new CancellationTokenSource(); using (_userDialogs.Loading(ConstantStrings.Loading, cancelText: ConstantStrings.Loading_Cancel, onCancel: contentCancellationTokenSource.Cancel)) { await loadContents(FilterDto); } eventAggregator.GetEvent <OpenNewsFilterPopupEvent>().Publish(new OpenNewsFilterPopupEvent()); FilterDto = new FilterNewsDto(); SelectedYear = null; SelectedMonth = null; }); OpenFilterPopup = new BitDelegateCommand(async() => { eventAggregator.GetEvent <OpenNewsFilterPopupEvent>().Publish(new OpenNewsFilterPopupEvent()); }); }
public EvaluationRequestWaitViewModel(IEvlRequestService evlRequestService, IPageDialogService dialogService) { _evlRequestService = evlRequestService; _dialogService = dialogService; Cancel = new BitDelegateCommand(async() => { if (await dialogService.DisplayAlertAsync(string.Empty, ConstantStrings.AreYouSureToCancel, ConstantStrings.Yes, ConstantStrings.No)) { await NavigationService.NavigateAsync($"/{nameof(NavigationPage)}/{nameof(MainMenuView)}"); } }); }
public MainViewModel() { SyncCommand = new BitDelegateCommand(Sync); SendHttpRequestCommand = new BitDelegateCommand(SendHttpRequest); SendHttpRequestUsingGeneratedCodeCommand = new BitDelegateCommand(SendHttpRequestUsingGeneratedCode); SendRefitRequestCommand = new BitDelegateCommand(SendRefitRequest); SendODataRequestCommand = new BitDelegateCommand(SendODataRequest); SendODataBatchRequestCommand = new BitDelegateCommand(SendODataBatchRequest); LogoutCommand = new BitDelegateCommand(Logout); ShowPopupCommand = new BitDelegateCommand(ShowPopup); OpenConsoleCommand = new BitDelegateCommand(OpenConsole); GoToSampleCommand = new BitDelegateCommand(GoToSample); RefreshPageCommand = new BitDelegateCommand(RefreshPage); }
public MenuViewModel(INavigationService navigationService, ISecurityService securityService) { GoToPage = new BitDelegateCommand <string>(async(page) => { await navigationService.NavigateAsync(page); }); Logout = new BitDelegateCommand(async() => { await securityService.Logout(); await navigationService.NavigateAsync("/Login"); }); }
public LoginViewModel( ISecurityService securityService, ISanaapAppLoginValidator loginValidator, IPageDialogService pageDialogService, ISanaapAppTranslateService translateService, IUserDialogs userDialogs) { Login = new BitDelegateCommand(async() => { registerCancellationTokenSource?.Cancel(); registerCancellationTokenSource = new CancellationTokenSource(); using (userDialogs.Loading(ConstantStrings.Loading, cancelText: ConstantStrings.Loading_Cancel, onCancel: registerCancellationTokenSource.Cancel)) { if (!loginValidator.IsValid(NationalCode, Mobile, out string errorMessage)) { await pageDialogService.DisplayAlertAsync("", translateService.Translate(errorMessage), "باشه"); return; } try { await securityService.LoginWithCredentials(NationalCode, Mobile, "SanaapResOwner", "secret"); await NavigationService.NavigateAsync($"/{nameof(NavigationPage)}/{nameof(MainMenuView)}"); } catch (Exception ex) { if (ex.Message.Contains("CustomerCouldNotBeFound")) { await pageDialogService.DisplayAlertAsync("", "کاربری با این مشخصات یافت نشد", "باشه"); } else if (translateService.Translate(ex.GetMessage(), out string translateErrorMessage)) { await pageDialogService.DisplayAlertAsync("", translateErrorMessage, "باشه"); } else { string error = ex.ToString(); throw; } } } }); Register = new BitDelegateCommand(async() => { await NavigationService.NavigateAsync(nameof(RegisterView)); }); }