public void MoveOrderToOrderArchive() { OrderArchiveSingleton.Instance.AddOrderToArchive(SavedOrder); OrderCatalogSingleton.Instance.RemoveOrder(SavedOrder); OnPropertyChanged(); MessageDialogHelper.Show("Ordren er flyttet til ordrearkivet!", "Oplysning"); }
private async void PublishStory() { var fb = new Facebook.FacebookClient(Session.ActiveSession.CurrentAccessTokenData.AccessToken); var postParams = new { name = "Facebook SDK for .NET", caption = "Build great social apps and get more installs.", description = "The Facebook SDK for .NET makes it easier and faster to develop Facebook integrated .NET apps.", link = "http://facebooksdk.net/", picture = "http://facebooksdk.net/assets/img/logo75x75.png" }; try { dynamic fbPostTaskResult = await fb.PostTaskAsync("/me/feed", postParams); var result2 = (IDictionary <string, object>)fbPostTaskResult; var successMessageDialog = new Windows.UI.Popups.MessageDialog("Posted Open Graph Action, id: " + (string)result2["id"]); await successMessageDialog.ShowAsync(); } catch (Exception ex) { MessageDialogHelper.Show("Exception during post: " + ex.Message); } }
public void CreateEvent() { // denne sindssyge oprettelse af et event, benytter sig af alle de properties fra ViewModellen // + den konverterede DateTime fra DateTimeConverteren if (EventViewModel.Description != null && EventViewModel.Name != null && EventViewModel.Place != null) { Event newEvent = new Event( Converter.DateTimeConverter.DateTimeOffsetAndTimeSetToDateTime(EventViewModel.Date, EventViewModel.Time), EventViewModel.Description, EventViewModel.Name, EventViewModel.Place); EventViewModel.EventCatalogSingleton.AddEvent(newEvent); } if (EventViewModel.Name == null) { MessageDialogHelper.Show("Name of event is empty", "Invalid event name"); } if (EventViewModel.Place == null) { MessageDialogHelper.Show("Location for event is empty", "Invalid location"); } }
public void CreateEvent() { try { if (EventViewModel.Name != null) { Event newEvent = new Event ( EventViewModel.Id, EventViewModel.Name, EventViewModel.Description, EventViewModel.Place, DateTimeConverter.DateTimeOffsetAndTimeSetToDateTime(EventViewModel.Date, EventViewModel.Time) ); EventViewModel.EventCatalogSingleton.AddEvent(newEvent); } else { throw new ArgumentException("En ny event blev ikke oprettet!"); } } catch (Exception ex) { MessageDialogHelper.Show("'Når man opretter en ny event skal alle felterne udfyldes!", ex.Message); } }
public async Task <User> Login() { string userName = TypedUserName; string password = TypedPassword; if (UserCatalogInstance.UserDictionary.Count == 0) { await UserCatalogInstance.LoadUsersToCatalogAsync(); } Dictionary <string, User> users = UserCatalogInstance.UserDictionary; if (users.ContainsKey(userName)) { if (users[userName].Password == password) { LoginUser = users[userName]; return(users[userName]); } MessageDialogHelper.Show("Password is case sensitive, please type the correct Password", "Incorrect Password"); } else { MessageDialogHelper.Show("Could not find User. Remember your username is case sensitive", "User not found"); } return(null); }
public void SelectImageFromPhone() { try { CoreApplicationView view = CoreApplication.GetCurrentView(); FileOpenPicker filePicker = new FileOpenPicker(); filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; filePicker.ViewMode = PickerViewMode.Thumbnail; filePicker.FileTypeFilter.Clear(); filePicker.FileTypeFilter.Add(".bmp"); filePicker.FileTypeFilter.Add(".png"); filePicker.FileTypeFilter.Add(".jpeg"); filePicker.FileTypeFilter.Add(".jpg"); filePicker.FileTypeFilter.Add(".gif"); filePicker.FileTypeFilter.Add(".ico"); filePicker.PickSingleFileAndContinue(); view.Activated += viewActivated; } catch (Exception ex) { MessageDialogHelper.Show(ex.Message, "Error!"); } }
public void add() { if (_viewModel.SelectedVaegt >= 100) { DaaseVaegt daase = new DaaseVaegt { ProcessOrderNr = _viewModel.NewSelectedVaegtKontrol.VaegtKontrol.ProcessOrdreNr, KontrolOrderNr = _viewModel.NewSelectedVaegtKontrol.VaegtKontrol.KontrolNr, DaaseNr = _viewModel.SelectedNr, DasseVaegt = _viewModel.SelectedVaegt }; if (PersistenceDaaseVaegt.Post(daase)) { _viewModel.Vaegts.Add(new Record(daase.DaaseNr, daase.DasseVaegt)); _viewModel.SelectedVaegt = 0; _viewModel.SelectedNr = _viewModel.SelectedNr + 1; ClearImage(); _viewModel.NewSelectedVaegtKontrol.Update(); GetEstement(); } } else { MessageDialogHelper.Show("Vægten skal være over 100 g", "Ugyldig værdi"); } }
public void AddRegisterUser() { AddNewUserCollection.Add(new UserModel(ID, Name, Email, Password, DateTime.Now.ToString())); Persistancy.PersistancyService.SaveNotesAsJsonAsync(AddNewUserCollection); MessageDialogHelper.Show("Welcome to France Vacances ", "User have been Registered"); }
//private Stopwatch _stopwatch = new Stopwatch(); public void Add() { ErrorMessage = null; //Indsætter ProcessOrderNr _viewModel.SelectedTappeKontrol.ProcessOrderNr = SelectedPOSingleton.GetInstance().ActiveProcessOrdre.ProcessOrdreNr; //Indsætter tid _viewModel.SelectedTappeKontrol.Tidspunkt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); _viewModel.SelectedTappeKontrol.Tidspunkt = _viewModel.SelectedTappeKontrol.Tidspunkt + _viewModel.TimeSpan; //Tjekker om der er fejl foreach (var f in _viewModel.Validatons) { if (f.Value.Besked != null) { AddToMessage(f.Value.Besked, f.Key); } } if (ErrorMessage != null) { MessageDialogHelper.Show(ErrorMessage, "Der mangler oplysninger"); } else { if (_validation.TjekPrimærNøgle(_viewModel.SelectedTappeKontrol.ProcessOrderNr, _viewModel.SelectedTappeKontrol.Tidspunkt)) { MessageDialogHelper.Show("Du har allerede lavet en på dette tidspunkt", "Tappe Kontrollen findes allerede"); } else { //Sætter Vægtkontrol til null if (_viewModel.SelectedTappeKontrol.VaegtKontrol == 0) { _viewModel.SelectedTappeKontrol.VaegtKontrol = -1; } //Sætter SmagsTestNr til Null if (_viewModel.SelectedTappeKontrol.SmagsTestNr == 0) { _viewModel.SelectedTappeKontrol.SmagsTestNr = -1; } //Sætter C02 til Null if (_viewModel.SelectedTappeKontrol.Co2Kontrol == 0) { _viewModel.SelectedTappeKontrol.Co2Kontrol = -1; } if (PersistenceTappeKontrol.Post(_viewModel.SelectedTappeKontrol)) { Clear(); //_viewModel.MiniutesLeft = 15; } } } }
public static void UpdateButton(int x, int y) { currentInstance._clickableGameMap[y * xDimension + x].RevealNode = true; currentInstance._tilesToWin--; if (currentInstance._tilesToWin == 0) { MessageDialogHelper.Show("You successfully found all the bombs!", "Win!"); } }
private bool CheckObject() { if (string.IsNullOrEmpty(txtFullName.Text.Trim())) { MessageDialogHelper.Show("Name is empty", "Checking"); return(false); } return(true); }
public void CreateOffer() { if (SavedOrder.OfferToOrder == null) { SavedOrder.CreateOffer(); } else { MessageDialogHelper.Show("Der er allerede oprettet et tilbud og du henvises herved til pågældende tilbud.", "Opmærksom"); } }
public void CreateInvoice() { if (SavedOrder.InvoiceToOrder == null) { SavedOrder.CreateInvoice(); } else { MessageDialogHelper.Show("Der er allerede oprettet en faktura og du henvises herved til den pågældende faktura.", "Opmærksom"); } SaveOrderCatalog(); }
private void ClickNode() { try { MinesVM.gameMap[_xPosition, _yPosition].Reveal(); } catch (LostGameException lge) { MessageDialogHelper.Show(lge.Message, "Game Over"); MainPage.gamePageInstance.Frame.Navigate(typeof(SettupPage)); } }
private static async Task <string> DeserializeOrdreFileAsync(string fileName) { try { StorageFile localFile = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName); return(await FileIO.ReadTextAsync(localFile)); } catch (FileNotFoundException ex) { MessageDialogHelper.Show("Loading for the first time? - Try Add and Save some Notes before trying to Save for the first time", "File not Found"); return(null); } }
public async void Gem() { GemIsEnabled = false; OnPropertyChanged(nameof(GemIsEnabled)); if (await CheckDato(RundvisningInstance.RundvisningDateTime) == true) { GemRundvisning(RundvisningInstance.RundvisningDateTime); OnPropertyChanged(nameof(RundvisningSingleton)); MessageDialogHelper.Show("Din rundvisning er reserveret", "Yay"); } GemIsEnabled = true; OnPropertyChanged(nameof(GemIsEnabled)); }
private async void btnRegister_Click(object sender, RoutedEventArgs e) { if (CheckObject()) { User _User = LoadUserObject(); MyResult result = await _DBAccess.SaveUserAsync(_User); MessageDialogHelper.Show(result.Message, "User"); if (result.IsSuccess) { Frame.Navigate(typeof(Profile)); } } }
// metode der kaldes i LoadNotesFromJsonAsync() private static async Task <string> DeserializeNotesFileAsync(string fileName) { try { StorageFile localFile = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName); return(await FileIO.ReadTextAsync(localFile)); } catch (FileNotFoundException e) { MessageDialogHelper.Show("Try save some data.", "Nothing loaded."); return(null); } }
public void AddStudent() { try { Student newStudent = new Student(CreateStudentViewModel.SelectedStudent.No, CreateStudentViewModel.SelectedStudent.Name, CreateStudentViewModel.SelectedStudent.YearOfBirth, CreateStudentViewModel.SelectedStudent.Address, CreateStudentViewModel.SelectedStudent.Email, CreateStudentViewModel.SelectedStudent.ImageSource); CreateStudentViewModel.StudentCatalog.Add(newStudent); } catch (YearOfBirthTooLow yex) { MessageDialogHelper.Show("Inden studenter må være født før 1950!", "Født alt for tidligt"); } }
private static async Task <string> DeserializeNotesFileAsync(string fileName) { try { StorageFile localFile = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName); return(await FileIO.ReadTextAsync(localFile)); } catch (FileNotFoundException ex) { MessageDialogHelper.Show("First run - Save the tables to create file", "File not Found"); return(null); } }
public static async Task <string> DeSerializeEventsFileAsync(String fileName) { try { StorageFile localFile = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName); return(await FileIO.ReadTextAsync(localFile)); } catch (FileNotFoundException ex) { MessageDialogHelper.Show("Loading for the first time? Try Adding and Save some Events before you are trying to Load Events!", "File not found!"); return(null); } }
private async void appbarSave_Click(object sender, RoutedEventArgs e) { if (CheckObject()) { Note _Note = LoadNoteObject(); MyResult result = await _DBAccess.SaveNoteAsync(_Note); MessageDialogHelper.Show(result.Message, "Note"); if (result.IsSuccess) { Frame.Navigate(typeof(NotesViewer)); } } }
private static async Task <string> DeserializeNotesFileAsync(string fileName) { try { StorageFile localFile = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName); return(await FileIO.ReadTextAsync(localFile)); } catch (FileNotFoundException ex) { MessageDialogHelper.Show("No users found... \nIf you're running the program for the first time, you should try to register a user!", "File not Found"); return(null); } }
public static async Task <string> DeSerializeHousehold(String fileName) { try { StorageFile localFile = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName); return(await FileIO.ReadTextAsync(localFile)); } catch (FileNotFoundException ex) { MessageDialogHelper.Show("Første gang der loades? Tilføj Husinformationer og gem for at kunne loade", "Fil findes ikke!"); return(null); } }
private static async Task <string> DeSerializeEventsFileAsync(String fileName) { try { StorageFile localFile = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName); return(await FileIO.ReadTextAsync(localFile)); } catch (FileNotFoundException ex) { MessageDialogHelper.Show("Filen for events blev ikke fundet \n File not found!", ex.Message); return(null); } }
public void UpdateStudent() { try { if (StudentViewModel.SelectedStudent != null) { StudentViewModel.StudentCatalog.Update(StudentViewModel.SelectedStudent, StudentViewModel.SelectedIndex); } } catch (YearOfBirthTooLow yex) { MessageDialogHelper.Show("Inden studenter må være født før 1950!", "Født alt for tidligt"); } }
private async System.Threading.Tasks.Task LoadNotes() { try { List <NoteView> list = new List <NoteView>(); list = await _DBAccess.LoadNotesByUserAsync(); list = list.OrderByDescending(x => x.Date).ToList(); lvwDailyNotes.ItemsSource = list; } catch (Exception ex) { MessageDialogHelper.Show(ex.Message, "Loading"); } }
public bool IsEmpty() { try { if (SelectedGreenKeeper.GreenkeeperName != "") { return(true); } return(false); } catch (Exception e) { MessageDialogHelper.Show("Greenkeeper er ikke valgt \n Opgaven kunne ikke gemmes!", e.Message); return(false); } }
public void Create(Event newEvent) { try { Validate(newEvent); Events.Add(newEvent); } catch (ValueEmptyException adex) { MessageDialogHelper.Show(adex.Message, "Event is not done being made"); } catch (ValueAlreadyExistException adex) { MessageDialogHelper.Show(adex.Message, "Another Event already has that"); } }
public static async Task SerializeStudentsFileAsync(string studentsString, string fileName) { try { StorageFile localFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting); await Task.Run(() => Thread.Sleep(5000)); await FileIO.WriteTextAsync(localFile, studentsString); } catch (IOException iox) { MessageDialogHelper.Show("Error creating the file", "IO error"); } }
private async void Image_Tapped1(object sender, TappedRoutedEventArgs e) { MessageDialogHelper ms = new MessageDialogHelper(); ms.Show("Bạn có muốn thoát chương trình", ""); }
private async Task GetSampleDataAsync() { if (this._groups.Count != 0) return; try { RssReader rss = new RssReader(); HttpClient Client = new HttpClient(); Client.DefaultRequestHeaders.Add("Cache-Control", "no-cache"); var xml = await Client.GetStringAsync(apiUrl1 +"?cache="+Guid.NewGuid().ToString()); var ketqua = rss.KetQua(xml); int i = 0; SampleDataGroup group = new SampleDataGroup("Group-1", "Tour Hot Khuyến Mãi"); foreach (var k in ketqua) { if (!k.Link.Contains("http:") && !k.Link.Contains("https:")) { k.Link = "http:" + k.Link; } string ip = k.Description.Substring(k.Description.LastIndexOf("src") + 5, k.Description.IndexOf("'", k.Description.LastIndexOf("src") + 6) - 5 - k.Description.LastIndexOf("src")); if(!ip.Contains("http:")&&!ip.Contains("https:")) { ip = "http:" + ip; } group.Items.Add(new SampleDataItem(i.ToString(), k.Title, k.Date, k.Description.Substring(k.Description.LastIndexOf("</a>") + 4, k.Description.Length - k.Description.LastIndexOf("</a>") - 4), k.Link, ip)); i++; } this.Groups.Add(group); xml = await Client.GetStringAsync(apiUrl2 + "?cache=" + Guid.NewGuid().ToString()); ketqua = rss.KetQua(xml); group = new SampleDataGroup("Group-2", "Tour Du Lịch Mới Nhất"); foreach (var k in ketqua) { if (!k.Link.Contains("http:") && !k.Link.Contains("https:")) { k.Link = "http:" + k.Link; } string ip = k.Description.Substring(k.Description.LastIndexOf("src") + 5, k.Description.IndexOf("'", k.Description.LastIndexOf("src") + 6) - 5 - k.Description.LastIndexOf("src")); if (!ip.Contains("http:") && !ip.Contains("https:")) { ip = "http:" + ip; } group.Items.Add(new SampleDataItem(i.ToString(), k.Title, k.Date, k.Description.Substring(k.Description.LastIndexOf("</a>") + 4, k.Description.Length - k.Description.LastIndexOf("</a>") - 4),k.Link, ip)); i++; } this.Groups.Add(group); xml = await Client.GetStringAsync(apiUrl3 + "?cache=" + Guid.NewGuid().ToString()); ketqua = rss.KetQua(xml); group = new SampleDataGroup("Group-3", "Ẩm Thực Khám Phá"); foreach (var k in ketqua) { if (!k.Link.Contains("http:") && !k.Link.Contains("https:")) { k.Link = "http:" + k.Link; } string ip = k.Description.Substring(k.Description.LastIndexOf("src") + 5, k.Description.IndexOf("'", k.Description.LastIndexOf("src") + 6) - 5 - k.Description.LastIndexOf("src")); if (!ip.Contains("http:") && !ip.Contains("https:")) { ip = "http:" + ip; } group.Items.Add(new SampleDataItem(i.ToString(), k.Title, k.Date, k.Description.Substring(k.Description.LastIndexOf("</a>") + 4, k.Description.Length - k.Description.LastIndexOf("</a>") - 4), k.Link, ip)); i++; } this.Groups.Add(group); Uri dataUri = new Uri("ms-appx:///DataModel/AboutUs.json"); StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri); string jsonText = await FileIO.ReadTextAsync(file); JsonObject jsonObject = JsonObject.Parse(jsonText); JsonArray jsonArray = jsonObject["Items"].GetArray(); group = new SampleDataGroup("Group-4", "Mô Tả"); foreach (JsonValue itemValue in jsonArray) { JsonObject itemObject = itemValue.GetObject(); group.Items.Add(new SampleDataItem(i.ToString(), itemObject["Title"].GetString(), itemObject["Type"].GetString(), "description", itemObject["Target"].GetString(), itemObject["Icon"].GetString())); i++; } this.Groups.Add(group); } catch (Exception ex) { MessageDialogHelper msg = new MessageDialogHelper(); msg.Show("Vui Lòng kiểm tra kết nối mạng", "Lỗi kết nối!"); } }