private void NewProject() { GlobalDataService.Instance.OriginHashCode = 0; GlobalDataService.Instance.CurrentProjectFile = null; GlobalDataService.Instance.CurrentProject = new HDEProject(); MenuNavigationHelper.UpdateView(typeof(TreeViewEditorViewModel).FullName, "reload" + DateTime.Now.Ticks); }
private void UpdateTrip() { Console.Write(_Childs); if (_Childs != null) { foreach (Child child in _Childs) { bool found = false; TripChild tripChild = new TripChild { TripId = _Id, ChildId = child.Id, Scanned = false }; foreach (TripChild trip in TripsChildren) { if (trip.TripId == _Id && trip.ChildId == child.Id) { found = true; } } if (found == false) { _tripChild = Newtonsoft.Json.JsonConvert.SerializeObject(tripChild); DatabaseHelper.Post("/TripsChildren", _tripChild); } } MenuNavigationHelper.UpdateView(typeof(TripsOverviewPage)); } //await Task.Delay(100); //GetAllAddedChildren(); }
private async void ImportDataEx() { try { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.List; picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary; picker.FileTypeFilter.Add(".csv"); var file = await picker.PickSingleFileAsync(); if (file != null) { using (var fs = await file.OpenReadAsync()) { var text = await fs.ReadTextAsync(Encoding.UTF8); var arrs = text.Split("\n"); var result = new List <TreeNodeFlatData>(); foreach (var txt in arrs) { var strs = txt.Split(","); if (strs.Length == 3) { var x = new TreeNodeFlatData { ParentCode = strs[0].Trim(), Code = strs[1].Trim(), Name = strs[2].Trim() }; result.Add(x); } else if (strs.Length == 2) { var x = new TreeNodeFlatData { ParentCode = strs[0].Trim(), Code = strs[1].Trim(), Name = strs[1].Trim() }; result.Add(x); } else { continue; } } GlobalDataService.Instance.CurrentProject.Nodes = BuildTree(result); MenuNavigationHelper.UpdateView(typeof(TreeViewEditorViewModel).FullName, "reload" + DateTime.Now.Ticks); } } } catch (Exception e) { await new ContentDialog { Title = "Load Failed", Content = $"{e.Message}", }.ShowAsync(); } }
//{[{ // By default, this handler expects URIs of the format 'wtsapp:sample?paramName1=paramValue1¶mName2=paramValue2' protected override async Task HandleInternalAsync(ProtocolActivatedEventArgs args) { // Create data from activation Uri in ProtocolActivatedEventArgs var data = new SchemeActivationData(args.Uri); if (data.IsValid) { MenuNavigationHelper.UpdateView(data.PageType, data.Parameters); } await Task.CompletedTask; }
//TODO change to later date private void test() { Trip trip = new Trip { Title = _Title, SupervisorId = _Supervisor.Id, Date = _Date }; _trip = Newtonsoft.Json.JsonConvert.SerializeObject(trip); PostTrip(_trip); MenuNavigationHelper.UpdateView(typeof(MainPage)); }
private void RegisterChild() { Child child = new Child { Name = _FirstName, LastName = _LastName, Class = _Class }; _child = Newtonsoft.Json.JsonConvert.SerializeObject(child); PostChild(_child); MenuNavigationHelper.UpdateView(typeof(MainPage)); // MenuNavigationHelper.UpdateView(typeof(ChildDetailPage), child); }
private void UpdateChild() { Child child = new Child { Id = _Id, Name = _FirstName, LastName = _LastName, Class = _Class }; _child = Newtonsoft.Json.JsonConvert.SerializeObject(child); PutChild(_child); MenuNavigationHelper.UpdateView(typeof(ChildDetailPage), child); }
private void GoBackToLastUnrestrictedPage() { var currentPage = NavigationService.Frame.Content as Page; var isCurrentPageRestricted = Attribute.IsDefined(currentPage.GetType(), typeof(Restricted)); if (isCurrentPageRestricted) { if (NavigationService.CanGoBack) { NavigationService.GoBack(); } else { MenuNavigationHelper.UpdateView(typeof(Param_HomeNamePage)); } } }
//{[{ // By default, this handler expects URIs of the format 'wtsapp:sample?paramName1=paramValue1¶mName2=paramValue2' protected override async Task HandleInternalAsync(ProtocolActivatedEventArgs args) { // Create data from activation Uri in ProtocolActivatedEventArgs var data = new SchemeActivationData(args.Uri); if (data.IsValid) { MenuNavigationHelper.UpdateView(data.PageType, data.Parameters); } else if (args.PreviousExecutionState != ApplicationExecutionState.Running) { // If the app isn't running and not navigating to a specific page based on the URI, navigate to the home page NavigationService.Navigate(typeof(Views.Param_HomeNamePage)); } await Task.CompletedTask; }
private async void OpenProject() { try { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.List; picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary; picker.FileTypeFilter.Add(".hdeproj"); var file = await picker.PickSingleFileAsync(); if (file != null) { using (var fs = await file.OpenReadAsync()) { using (var sr = new StreamReader(fs.AsStreamForRead())) { var alltext = await sr.ReadToEndAsync(); var result = Newtonsoft.Json.JsonConvert.DeserializeObject <HDEProject>(alltext); if (result != null) { GlobalDataService.Instance.CurrentProject = result; GlobalDataService.Instance.OriginHashCode = result.GetHashCode(); GlobalDataService.Instance.CurrentProjectFile = file.Path; MenuNavigationHelper.UpdateView(typeof(TreeViewEditorViewModel).FullName, "reload" + DateTime.Now.Ticks); StorageApplicationPermissions.FutureAccessList.AddOrReplace("futureAccessToken", file); } else { throw new Exception("parse failed"); } } } } } catch (Exception e) { await new ContentDialog { Title = "Load Failed", Content = $"{e.Message}", PrimaryButtonText = "Ok" }.ShowAsync(); } }
private async void ImportData() { try { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.List; picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary; picker.FileTypeFilter.Add(".json"); var file = await picker.PickSingleFileAsync(); if (file != null) { using (var fs = await file.OpenReadAsync()) { using (var sr = new StreamReader(fs.AsStreamForRead())) { var alltext = await sr.ReadToEndAsync(); var result = Newtonsoft.Json.JsonConvert.DeserializeObject <ObservableCollection <TreeNode> >(alltext); if (result != null) { GlobalDataService.Instance.CurrentProject.Nodes = result; MenuNavigationHelper.UpdateView(typeof(TreeViewEditorViewModel).FullName, "reload" + DateTime.Now.Ticks); } else { throw new Exception("parse failed"); } } } } } catch (Exception e) { await new ContentDialog { Title = "Load Failed", Content = $"{e.Message}", PrimaryButtonText = "Ok" }.ShowAsync(); } }
/// <summary> /// Registers the User /// </summary> private async Task RegisterAsync() { if (!PasswordField.Equals(PasswordConfirmedField) || !IsValidEmail(EmailField) || PasswordField.Length < 6) { return; } var user = new User() { EmailAddress = EmailField, FirstName = FirstNameField, LastName = LastNameField, DateOfBirth = DateOfBirthField.DateTime, Password = PasswordField }; var created = await _dataAccess.AddEntryToDatabase(user); if (created) { MenuNavigationHelper.UpdateView(typeof(SignInPage)); } }
private async Task Login() { var users = await _dataAccess.GetDataFromUri <User>("Users"); var validUser = users .Where(u => u.EmailAddress == EmailField) .Select(u => u) .Where(st => st.Password == PasswordField) .Select(u => u) .ToList(); if (validUser.Count != 1) { return; } ApplicationData.Current.LocalSettings.Values["user"] = new ApplicationDataCompositeValue() { ["id"] = validUser[0].UserId }; MenuNavigationHelper.UpdateView(typeof(MainPage)); }
private void OnTripPlanOverview() => MenuNavigationHelper.UpdateView(typeof(TripPlannerPage));
private void OnMenuViewsProfile() => MenuNavigationHelper.UpdateView(typeof(ProfilePage));
private void OnMenuViewsRegister() => MenuNavigationHelper.UpdateView(typeof(RegisterPage));
private void OnMenuViewsSignIn() => MenuNavigationHelper.UpdateView(typeof(SignInPage));
private void OnMenuViewsMain() => MenuNavigationHelper.UpdateView(typeof(MainPage));
private void OnMenuViewsTemplateExporter() => MenuNavigationHelper.UpdateView(typeof(TemplateExporterViewModel).FullName, DateTime.Now);
//^^ //{[{ private void ShellMenuItemClick_Views_wts.ItemName(object sender, RoutedEventArgs e) { MenuNavigationHelper.UpdateView(typeof(wts.ItemNamePage)); }
private void OnMenuViewsTreeViewEditor() => MenuNavigationHelper.UpdateView(typeof(TreeViewEditorViewModel).FullName, DateTime.Now);
private static void NavigateToRegister() => MenuNavigationHelper.UpdateView(typeof(RegisterPage));
private void ShellMenuItemClick_Views_MasterDetail(object sender, RoutedEventArgs e) { MenuNavigationHelper.UpdateView(typeof(MasterDetailPage)); }
private void OnViewsChildDetail() => MenuNavigationHelper.UpdateView(typeof(ChildDetailPage));
public void ClickedChild(object sender, ItemClickEventArgs e) { var clickedItem = (Child)e.ClickedItem; MenuNavigationHelper.UpdateView(typeof(ChildDetailPage), clickedItem); }
private void OnMenuViewsMain() => MenuNavigationHelper.UpdateView(typeof(MainViewModel).FullName);
private void OnViewsTripsOverview() => MenuNavigationHelper.UpdateView(typeof(TripsOverviewPage));
private void OnViewsChildrenOverview() => MenuNavigationHelper.UpdateView(typeof(ChildrenOverviewPage));
private void OnMenuViewsMediaPlayer() => MenuNavigationHelper.UpdateView(typeof(MediaPlayerViewModel).FullName);
public void ClickItemListPast(object sender, ItemClickEventArgs e) { var clickedItem = (Trip)e.ClickedItem; MenuNavigationHelper.UpdateView(typeof(TripDetailPage), clickedItem); }