public bool IncludeNewItemInMainTab(MenuN1Item.MenuN1ItemParameters parameter = 0) { // a dynamic object that is used to set the view that will be included in tab BaseViewModel newViewModel; switch (parameter) { case MenuN1Item.MenuN1ItemParameters.TestViewModel: newViewModel = new TestViewModel(VerifyPermission(parameter), visibility: true); break; case MenuN1Item.MenuN1ItemParameters.MainViewModel: newViewModel = new MainViewModel(VerifyPermission(parameter), visibility: true); break; default: return(false); } int viewsToShowTotalTabs = ViewsToShow.Count(); if (viewsToShowTotalTabs >= 0) { //verify if tab is already open, but now nothing is done. bool tabAlreadyOpen = ViewsToShow.Any(t => t.MenuN1ItemParameter.Equals(newViewModel.MenuN1ItemParameter)); ViewsToShow.Add(newViewModel); SelectedViewToShow = newViewModel; } return(true); }
public async void RemoveItemInMainTabCollection(object parameter = null) { var sampleMessageDialog = new YesNoDialog { DataContext = new YesNoDialogViewModel { TitleDialog = "Whant close?", MessageDialog = "You will lose not saved data. Do you really want close it?", TrueButtonDialog = "Close", FalseButtonDialog = "Cancel" } }; var dialogResult = await DialogHost.Show(sampleMessageDialog, "MainDialog"); if ((bool)dialogResult) { int viewsToShowTotalTabs = ViewsToShow.Count(); if (viewsToShowTotalTabs >= 0) { //var tabToRemove = ViewsToShow.FirstOrDefault(); var tabToRemove = (BaseViewModel)parameter; if (tabToRemove.CanCloseIt) { ViewsToShow.Remove(tabToRemove); } //SelectedViewToShow = ; } } var dialog = new OneIconDialog { DataContext = new OneIconDialogViewModel { TitleDialog = "Done!", MessageDialog = "Item closed ;)", IconName = "Check", } }; await CreateGenericOneIconDialog("Done!", "Item closed ;)", "Ok...", true, "check", ""); //await DialogHost.Show(dialog, "MainDialog"); // //var result = await DialogHost.Show("a", "MainDialog"); //return true; }