public CreateListPage(CreateListVM vm) { InitializeComponent(); this.BindingContext = vm; (this.BindingContext as CreateListVM).Navi = this.Navigation; }
public ItemListPage(CreateListVM vm) { vm.PoolItem = vm.AllItems.DefaultIfEmpty(vm.AllItems.First()).FirstOrDefault(x => x.Name.StartsWith(vm.NewItem.ToString(), StringComparison.CurrentCultureIgnoreCase)); this.BindingContext = vm; InitializeComponent(); }
public LineItem(string txt, CreateListVM parentArg) { this.Text = txt; this.parent = parentArg; this.DeleteCmd = new Command((item) => { this.Parent.Lines.Remove(Me); }); }
public LoginPage(BaseVM vm) { InitializeComponent(); CreateListVM cl = vm as CreateListVM; cl.Login = StoreFactory.HalProxy.GetLogin(cl); try { this.BindingContext = vm; } catch (Exception ex) { StoreFactory.CurrentVM.Logs.Add(ex.Message); } }
public MainVM(MainPage pageArg) { var vm = new CommonVM() { Parent = this }; SettingsBaseVM settingVm = new SettingsVM(StoreFactory.HalProxy.ReadSettings()); CreateListVM listVm = new CreateListVM(); vm.Order = new OutputLineVisitor(vm); StoreFactory.CurrentVM = vm; listVm.Parent = vm.Parent; // foreach(var line in StoreFactory.HalProxy.ReadGmail()) // vm.Logs.Add(line); this.Pages.Add(new PageItem() { Title = Resources.TextResource.Gmail, Icon = StoreFactory.HalProxy.ResourcePrefix + "mail.png", Type = typeof(LoginPage), VM = listVm, Page = new LoginPage(listVm) }); this.Pages.Add(new PageItem() { Title = Resources.TextResource.CreateList, Icon = StoreFactory.HalProxy.ResourcePrefix + "edit.png", Type = typeof(CreateListPage), VM = listVm, Page = new CreateListPage(listVm) }); this.Pages.Add(new PageItem() { Title = Resources.TextResource.InputList, Icon = StoreFactory.HalProxy.ResourcePrefix + "in.png", Type = typeof(InputPage), VM = vm, Page = new InputPage(vm) }); this.Pages.Add(new PageItem() { Title = Resources.TextResource.OutputList, Icon = StoreFactory.HalProxy.ResourcePrefix + "out.png", Type = typeof(OutputPage), VM = vm, Page = new OutputPage(vm) }); this.Pages.Add(new PageItem() { Title = Resources.TextResource.CarouselList, Icon = StoreFactory.HalProxy.ResourcePrefix + "carousel.png", Type = typeof(CarouselOutput), VM = vm, Page = new CarouselOutput(vm) }); this.Pages.Add(new PageItem() { Title = Resources.TextResource.Settings, Icon = StoreFactory.HalProxy.ResourcePrefix + "settings.png", Type = typeof(SettingsPage), VM = settingVm, Page = new SettingsPage(settingVm) }); this.Pages.Add(new PageItem() { Title = Resources.TextResource.Logs, Icon = StoreFactory.HalProxy.ResourcePrefix + "logs.png", Type = typeof(LogsPage), VM = vm, Page = new LogsPage() }); OnPropertyChanged("Pages"); this.GoToPageCmd = new Command(() => { string typeName = "InputPage"; switch (typeName.ToString()) { case "LoginPage": this.Navi.PushAsync(this.Pages[0].Page, true); break; case "CreateListPage": this.Navi.PushAsync(this.Pages[1].Page, true); break; case "InputPage": this.Navi.PushAsync(this.Pages[2].Page, true); break; case "Output": this.Navi.PushAsync(this.Pages[3].Page, true); break; case "Carousel": this.Navi.PushAsync(this.Pages[4].Page, true); break; case "SettingsPage": this.Navi.PushAsync(this.Pages[5].Page, true); break; case "LogsPage": this.Navi.PushAsync(this.Pages[6].Page, true); break; } }); StoreFactory.MainVM = this; this.page = pageArg; }
public CreateListMenu(CreateListVM vm) { this.parentVm = vm; this.NewListCmd = new Command((nothing) => { this.CanMove = true; vm.Lines.Clear(); }); this.PublishCmd = new Command(async(nothing) => { try { this.InProgress = true; if (this.PublishActive) { try { this.parentVm.Percentage = 0; this.PublishActive = false; if ((StoreFactory.HalProxy.NetworkConnected && StoreFactory.Settings.FromCloud) || StoreFactory.Settings.FromSMS) { StoreFactory.CurrentVM.Logs.Add("Sending Message"); await MessageSender.SendText(vm.Lines.Select(x => x.Text).ToArray(), this.OnProgress); } else { StoreFactory.CurrentVM.Logs.Add("Sending notification"); StoreFactory.HalProxy.SendNotification("nakup " + DateTime.Now, vm.Lines.Select(x => x.Text).ToArray()); } } catch (Exception ex) { StoreFactory.CurrentVM.Logs.Add(ex.Message); } finally { this.PublishActive = true; StoreFactory.CurrentVM.Logs.Add(vm.ErrorMsg); } } else { this.parentVm.ErrorMsg = Resources.TextResource.EmptyList; StoreFactory.HalProxy.ShowMessage(Resources.TextResource.EmptyList); } } finally { this.InProgress = false; } }); this.MoveToInputCmd = new Command((nothing) => { if (this.CanMove) { StoreFactory.Items.InitInput(vm.Lines.Select(x => x.Text).ToList(), vm.RemoveDuplicities, StoreFactory.CurrentVM); (StoreFactory.CurrentVM.Parent as MainVM).SetPageIndex(2); } else { this.parentVm.ErrorMsg = Resources.TextResource.EmptyList; StoreFactory.HalProxy.ShowMessage(Resources.TextResource.EmptyList); } }); this.RecordCmd = new Command((nothing) => { try { if (this.InProgress) { this.InProgress = false; this.RecordButtonLabel = Resources.TextResource.StartListening; } else { this.InProgress = true; this.RecordButtonLabel = Resources.TextResource.StopListening; vm.Lines.Clear(); var err = StoreFactory.HalProxy.RecordLines(this.OnRecognizedText, StoreFactory.Settings.CurrentLanguage); if (err.IsError) { this.InProgress = false; this.RecordButtonLabel = Resources.TextResource.StartListening; vm.ErrorMsg = err.ToString(); StoreFactory.HalProxy.MakeToast(this.parentVm.ErrorMsg); } } } catch (Exception ex) { StoreFactory.CurrentVM.Logs.Add(ex.Message); StoreFactory.CurrentVM.Logs.Add(ex.StackTrace); } }); }