public override void Initialize(IViewModelHost host) { base.Initialize(host); // set RegisterCommand to defer to the DoRegistration method... this.RegisterCommand = new DelegateCommand((args) => DoRegistration(args as CommandExecutionContext)); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); ViewMonthlyServiceCommand = new DelegateCommand((e) => { //set servicetypeid MFundiRuntime.ServiceTypeID = 2; Host.ShowView(typeof(IChargePageViewModel)); }); ViewDayServiceCommand = new DelegateCommand((e) => { MFundiRuntime.ServiceTypeID = 1; Host.ShowView(typeof(IChargePageViewModel)); }); LogoutCommand = new DelegateCommand(async(e) => { // sign out await LogOut(); }); TaskDoneCommand = new DelegateCommand((e) => { // mark task as complete Host.ShowView(typeof(IPendingTicketsPageViewModel)); }); }
internal static Task ShowAlertAsync(this IViewModelHost page, string message) { // show... MessageDialog dialog = new MessageDialog(message != null ? message : string.Empty); return(dialog.ShowAsync().AsTask()); }
public StoryPageViewModel(IViewModelHost host) : base(host) { this.Streams = new ObservableCollection <StreamItem>(); // commands... this.CancelCommand = new DelegateCommand((args) => { //if(this.IsDirty && await this.Host.ConfirmAsync()) // this.Host.GoBack(); //else this.Host.GoBack(); }); this.SaveCommand = new DelegateCommand(async(args) => await HandleSaveAsync()); this.DeleteCommand = new DelegateCommand(async(args) => { if (await this.Host.ConfirmAsync()) { await this.Item.SoftDeleteAsync(); this.Host.GoBack(); } }); }
internal static IAsyncOperation <IUICommand> ShowAlertAsync(this IViewModelHost page, string message) { // show... MessageDialog dialog = new MessageDialog(message != null ? message : string.Empty); return(dialog.ShowAsync()); }
public LogonPageViewModel(IViewModelHost host) : base(host) { // set RegisterCommand to defer to the DoRegistration method... this.LogonCommand = new DelegateCommand((args) => DoLogon(args as CommandExecutionContext)); this.RegisterCommand = new NavigateCommand<IRegisterPageViewModel>(host); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); // set... this.RegisterCommand = new NavigateCommand <IRegisterPageViewModel>(host); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); SubmitCommand = new DelegateCommand((args) => Submit(args as CommandExecutionContext)); //if (localSettings.Values.ContainsKey("VerifyPhone")) // PhoneNumber = localSettings.Values["VerifyPhone"].ToString(); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); Locations = new List <string>(); locations = new List <string>(); SubmitCommand = new DelegateCommand((args) => Submit(args as CommandExecutionContext)); UpdateListCommand = new DelegateCommand((args) => Suggest(args as CommandExecutionContext)); }
public ReportsPageViewModel(IViewModelHost host) : base(host) { // setup... this.Items = new ObservableCollection<ReportItem>(); // commands... this.RefreshCommand = new DelegateCommand(async (e) => await this.DoRefresh(true)); }
public ShareTargetPageViewModel(IViewModelHost host) : base(host) { this.ShowImage = false; this.Sharing = false; this.SupportsComment = true; this.ShareCommand = new DelegateCommand(async (args) => await HandleShareCommandAsync()); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); HireCommand = new DelegateCommand((args) => Hire(args as CommandExecutionContext)); CancelCommand = new NavigateCommand <IHomePageViewModel>(host); CallCommand = new DelegateCommand((args) => Call(args as CommandExecutionContext)); RequestOtherCommand = new DelegateCommand((args) => Other(args as CommandExecutionContext)); }
public StreamsPageViewModel(IViewModelHost host) : base(host) { this.Streams = new ObservableCollection <StreamViewItem>(); this.NewCommand = new DelegateCommand(async(args) => { this.Host.ShowView <StoryPageViewModel>(await StoryItem.CreateForNewAsync()); }); }
internal static void InitializeViewModel(this IViewModelHost page) { // create the model - ultimately we'll replace this with an IoC container... var model = new RegisterPageViewModel(); model.Initialize(page); // set the data context... ((Page)page).DataContext = model; }
public StreamsPageViewModel(IViewModelHost host) : base(host) { this.Streams = new ObservableCollection<StreamViewItem>(); this.NewCommand = new DelegateCommand(async (args) => { this.Host.ShowView<StoryPageViewModel>(await StoryItem.CreateForNewAsync()); }); }
public SearchResultsPageViewModel(IViewModelHost host) : base(host) { this.MasterItems = new List<ReportViewItem>(); this.Results = new ObservableCollection<ReportViewItem>(); this.Filters = new ObservableCollection<SearchFilter>(); // command... this.SelectionCommand = new NavigateCommand<IReportPageViewModel>(this.Host); }
public ReportsPageViewModel(IViewModelHost host) : base(host) { // setup... this.Items = new ObservableCollection<ReportViewItem>(); this.SelectedItems = new List<ReportViewItem>(); // commands... this.RefreshCommand = new DelegateCommand(async (e) => { this.Host.HideAppBar(); await this.DoRefresh(true); // toast... string message = "I found 1 report."; if (this.Items.Count != 1) message = string.Format("I found {0} reports.", this.Items.Count); var toast = new ToastNotificationBuilder(new string[] { "Reports refreshed.", message }); toast.ImageUri = "ms-appx:///Assets/Toast.jpg"; toast.Update(); }); // update any selection that we were given... this.SelectionCommand = new DelegateCommand((args) => { // update the selection... this.SelectedItems.Clear(); foreach (ReportViewItem item in (IEnumerable<object>)args) this.SelectedItems.Add(item); // raise... this.OnPropertyChanged("SelectedItems"); this.OnPropertyChanged("HasSelectedItems"); }); // dump the state... this.DumpSelectionCommand = new DelegateCommand(async (e) => { if (this.SelectedItems.Count > 0) { var builder = new StringBuilder(); foreach (var item in this.SelectedItems) { if (builder.Length > 0) builder.Append("\r\n"); builder.Append(item.Title); } // show... await this.Host.ShowAlertAsync(builder.ToString()); } else await this.Host.ShowAlertAsync("(No selection)"); }); }
public SearchResultsPageViewModel(IViewModelHost host) : base(host) { this.MasterItems = new List<ReportViewItem>(); this.Results = new ObservableCollection<ReportViewItem>(); this.Filters = new ObservableCollection<SearchFilter>(); // command... this.SelectionCommand = new DelegateCommand(async (args) => { await this.Host.ShowAlertAsync("Selected: " + ((ReportViewItem)args).Title); }); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); Locations = new List <string>(); locations = new List <string>(); SignUpCommand = new DelegateCommand((args) => DoRegister(args as CommandExecutionContext)); SignInCommand = new DelegateCommand((args) => DoLogin(args as CommandExecutionContext)); VerifyCommand = new DelegateCommand((args) => Verify(args as CommandExecutionContext)); ForgotCommand = new DelegateCommand((args) => ForgotPassword(args as CommandExecutionContext)); UpdateListCommand = new DelegateCommand((args) => Suggest(args as CommandExecutionContext)); IsSelected = true; }
public override void Initialize(IViewModelHost host) { base.Initialize(host); if (MFundiRuntime.ServiceTypeID == 1) { SummaryText = res.GetString("StandardFee"); } else { SummaryText = res.GetString("FinderFee"); } //prompt to pay and proceed to view maid ProceedCommand = new DelegateCommand((args) => Proceed(args as CommandExecutionContext)); }
public ReportsPageViewModel(IViewModelHost host) : base(host) { // setup... this.Items = new ObservableCollection<ReportViewItem>(); this.SelectedItems = new List<ReportViewItem>(); // commands... this.RefreshCommand = new DelegateCommand(async (e) => { this.Host.HideAppBar(); await this.DoRefresh(true); }); // update any selection that we were given... this.SelectionCommand = new DelegateCommand((args) => { // update the selection... this.SelectedItems.Clear(); foreach (ReportViewItem item in (IEnumerable<object>)args) this.SelectedItems.Add(item); // raise... this.OnPropertyChanged("SelectedItems"); this.OnPropertyChanged("HasSelectedItems"); }); // dump the state... this.DumpSelectionCommand = new DelegateCommand(async (e) => { if (this.SelectedItems.Count > 0) { var builder = new StringBuilder(); foreach (var item in this.SelectedItems) { if (builder.Length > 0) builder.Append("\r\n"); builder.Append(item.Title); } // show... await this.Host.ShowAlertAsync(builder.ToString()); } else await this.Host.ShowAlertAsync("(No selection)"); }); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); HireCommand = new DelegateCommand((args) => Hire(args as CommandExecutionContext)); CancelCommand = new NavigateCommand <IHomePageViewModel>(host); CallCommand = new DelegateCommand((args) => Call(args as CommandExecutionContext)); RequestOtherCommand = new DelegateCommand((args) => Other(args as CommandExecutionContext)); if (MFundiRuntime.ServiceTypeID == 2) { IsMonthly = true; } else { IsMonthly = false; } }
public override void Initialize(IViewModelHost host) { base.Initialize(host); ErrorBucket errors = new ErrorBucket(); Items = new ObservableCollection <TicketItem>(); SelectedTicket = new TicketItem(); SubmitCommand = new DelegateCommand(async(e) => { TicketID = (int)e; MFundiRuntime.TicketID = TicketID.ToString(); var proxy = TinyIoCContainer.Current.Resolve <ITaskCompleteServiceProxy>(); using (EnterBusy()) { var result = await proxy.TaskCompleteAsync(TicketID); if (!(result.HasErrors)) { if (result.Status != "success") { errors.CopyFrom(result); } else { var toast = new ToastNotificationBuilder(new string[] { result.Message }); toast.Update(); Host.ShowView(typeof(IEvaluationPageViewModel)); } } else { errors.CopyFrom(result); } if (errors.HasErrors) { await Host.ShowAlertAsync(errors.GetErrorsAsString()); } } }); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); // commands... this.RefreshCommand = new DelegateCommand(async(e) => { this.Host.HideAppBar(); await this.DoRefresh(true); // toast... string message = StringHelper.Format("Reports_Toast_IFound1Report"); if (this.Items.Count != 1) { message = StringHelper.Format("Reports_Toast_IFoundNReports", this.Items.Count); } var toast = new ToastNotificationBuilder(new string[] { StringHelper.Format("Reports_Toast_ReportsRefreshed"), message }); toast.ImageUri = "ms-appx:///Assets/Toast.jpg"; toast.Update(); }); // open the singleton report view... this.SelectionCommand = new NavigateCommand <IReportPageViewModel>(this.Host); // show the location... this.ShowLocationCommand = new DelegateCommand(async(e) => { // get the location... var result = await LocationHelper.GetCurrentLocationAsync(); if (result.Code == LocationResultCode.Ok) { await this.Host.ShowAlertAsync(string.Format("Lat: {0}, Long: {1}, Accuracy: {2}", result.Location.Coordinate.Latitude, result.Location.Coordinate.Longitude, result.Location.Coordinate.Accuracy)); } else { await this.Host.ShowAlertAsync("Failed to get location: " + result.Code.ToString()); } }); // add... this.NewCommand = new DelegateCommand((e) => this.Host.ShowView(typeof(IEditReportPageViewModel), new ReportViewItem(new ReportItem()))); }
internal static void InitializeViewModel(this IViewModelHost host, IViewModel model = null) { // if we don't get given a model? if (model == null) { var attr = (ViewModelAttribute)host.GetType().GetTypeInfo().GetCustomAttribute <ViewModelAttribute>(); if (attr != null) { model = (IViewModel)TinyIoCContainer.Current.Resolve(attr.ViewModelInterfaceType); } else { throw new InvalidOperationException(string.Format("Page '{0}' is not decorated with ViewModelAttribute.")); } } // setup... model.Initialize((IViewModelHost)host); ((Page)host).DataContext = model; }
public virtual void Initialize(IViewModelHost host) { this.Host = host; }
public HelpPaneViewModel(IViewModelHost host) : base(host) { WebHelpCommand = new DelegateCommand(async (args) => await SettingsInteractionHelper.ShowWebHelpAsync()); }
public ViewModel(IViewModelHost host) : base(host) { }
public static void ShowView <T>(this IViewModelHost host, object parameter = null) where T : IViewModel { host.ShowView(typeof(T), parameter); }
protected ViewModel(IViewModelHost host) { this.Host = host; }
public MySettingsPaneViewModel(IViewModelHost host) : base(host) { }
public override void Initialize(IViewModelHost host) { base.Initialize(host); ForgotCommand = new DelegateCommand((args) => ForgotPassword(args as CommandExecutionContext)); }
internal static IViewModel GetModel(this IViewModelHost page) { return(((Control)page).DataContext as IViewModel); }
public NavigateCommand(IViewModelHost host) { this.Host = host; }
internal static IAsyncOperation <IUICommand> ShowAlertAsync(this IViewModelHost page, ErrorBucket errors) { return(ShowAlertAsync(page, errors.GetErrorsAsString())); }
public RegisterPageViewModel(IViewModelHost host) : base(host) { // set RegisterCommand to this.RegisterCommand = new DelegateCommand((args) => DoRegistration()); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); SubmitCommand = new DelegateCommand((args) => Evaluate(args as CommandExecutionContext)); }
public override void Initialize(IViewModelHost host) { base.Initialize(host); this.RegisterCommand = new NavigateCommand<IRegisterPageViewModel>(host); }
//// event for the change... //public event PropertyChangedEventHandler PropertyChanged; public ViewModel(IViewModelHost host) { this.Host = host; //this.Values = new Dictionary<string, object>(); }
// specialised GetHandler implementation... public U GetHandler <U>(IViewModelHost host) where U : IViewModel { return(GetHandlerInternal <U>(host)); }
public ViewModel(IViewModelHost host) { this.Host = host; }
internal static Task ShowAlertAsync(this IViewModelHost page, ErrorBucket errors) { return(ShowAlertAsync(page, errors.GetErrorsAsString())); }