protected override void OnNavigatedTo(NavigationEventArgs e) { BackStackClass.SetBackButtonVisibility(); BackStackClass.Navigate(typeof(Laskin2Projected), e.Parameter); if (e.Parameter != null && e.Parameter is Tapahtuma) { float yht_hinta = 0; tapahtuma = (Tapahtuma)e.Parameter; TapahtumaNimi.Text = Localization.GetLocalizedTextWithVariables("EventX", tapahtuma.nimi); //TapahtumaNimi.Text = "Tapahtuma:\n" + tapahtuma.nimi; Tuotenimi.Text = ""; Tuotemaara.Text = ""; Yhteishinta.Text = ""; foreach (MyyntiArtikkeli ma in tapahtuma.myyntitapahtuma.ostoslista.myyntiArtikkelit) { if (ma.maara > 0) { Tuotenimi.Text = Tuotenimi.Text + ma.nimi + "\n"; Tuotemaara.Text = Tuotemaara.Text + ma.maara.ToString() + " " + Localization.GetLocalizedText("pcs") + "\n"; Yhteishinta.Text = Yhteishinta.Text + (ma.maara * ma.hinta).ToString() + " " + Settings.getCurrency() + "\n"; yht_hinta += (ma.maara * ma.hinta); } SumBlock.Text = yht_hinta.ToString(); } EuroaBlock.Text = Settings.getCurrency(); Euroa2Block.Text = Settings.getCurrency(); Euroa3Block.Text = Settings.getCurrency(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { InitialKieliBoxDefinition = true; KieliBox.ItemsSource = LanguageNames; KieliBox.SelectedIndex = appSettings.selectedLanguage; InitialKieliBoxDefinition = false; ValuuttaBox.ItemsSource = Currencies; ValuuttaBox.SelectedIndex = appSettings.SelectedCurrency; BackStackClass.SetBackButtonVisibility(); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { BackStackClass.SetBackButtonVisibility(); if (e.NavigationMode == NavigationMode.Back) { /* Asynkroninen operaatio ilman varoituksia. */ string s = Localization.GetLocalizedTextWithVariables("EventXStoppedMsg", Tapahtuma.getTapahtuma().nimi); Task task = new MessageDialog(s).ShowAsync().AsTask(); /* Sulje tapahtuma*/ Tapahtuma.hylkääTapahtuma(); BackStackClass.Navigate(typeof(StartupProjected)); } try { Hinnastot = await InputOutput.ReadObjectFromXmlFileAsync <List <Hinnasto> >("KioskiLaskinHinnastot.xml"); ChangeCurrencies(Hinnastot); defineLastUid(); } catch (Exception ex) when(ex is System.IO.FileNotFoundException || ex is System.InvalidOperationException) { Hinnastot = new List <Hinnasto>(); } if (Hinnastot == null) { Hinnastot = new List <Hinnasto>(); } EditBox2.Visibility = Visibility.Collapsed; EditBox2Header.Visibility = Visibility.Collapsed; ArtikkeliQuery.Visibility = Visibility.Collapsed; EditBox.Visibility = Visibility.Collapsed; EditBoxHeader.Visibility = Visibility.Collapsed; HinnastoQuery.Visibility = Visibility.Collapsed; if (Hinnastot.Count > 0) { listHinnasto.ItemsSource = Hinnastot; listHinnasto.SelectedIndex = 0; EditBox.Visibility = Visibility.Collapsed; } else { listHinnasto.ItemsSource = null; LuoEnsimmainenHinnasto(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { BackStackClass.SetBackButtonVisibility(); if (e.Parameter != null) { tapahtuma = Tapahtuma.getTapahtuma(); if (tapahtuma == null) { if (e.Parameter is Tapahtuma) { tapahtuma = (Tapahtuma)e.Parameter; Tapahtuma.UpdateTapahtuma(tapahtuma); } else if (e.Parameter is Hinnasto) { tapahtuma = new Tapahtuma(); DateTime localDate = DateTime.Today; tapahtuma.Paivamaara = localDate.Date.Day.ToString() + "-" + localDate.Date.Month.ToString() + "-" + localDate.Date.Year.ToString(); { tapahtuma.MaaritaHinnasto((Hinnasto)e.Parameter); NimiTapahtumalle(); } } else { /* Problem */ throw new NotImplementedException(); } } if (tapahtuma.myyntitapahtuma == null) { tapahtuma.LisaaMyyntiTapahtuma(); } if (listArtikkelit.Visibility == Visibility.Visible) { PiilotaEditori(); PageEnabled(true); } EuroaBlock.Text = Settings.getCurrency(); BackStackClass.Navigate(typeof(Laskin_Projected), e.Parameter); calculateSum(); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { float yht_hinta = 0; BackStackClass.SetBackButtonVisibility(); Myyntitapahtuma TapahtumanMyyntiTapahtumat = new Myyntitapahtuma(); if (e.Parameter is Tapahtuma) { Tapahtuma t = (Tapahtuma)e.Parameter; TapahtumanMyyntiTapahtumat.uusiOstoslista(t.hinnasto); foreach (Myyntitapahtuma mt in t.Myyntitapahtumat) { foreach (MyyntiArtikkeli ma in mt.ostoslista.myyntiArtikkelit) { foreach (MyyntiArtikkeli tma in TapahtumanMyyntiTapahtumat.ostoslista.myyntiArtikkelit) { if (ma.nimi == tma.nimi) { tma.maara += ma.maara; } } } } TapahtumanNimi.Text = "Tapahtuma: " + t.nimi; Tuotenimi.Text = ""; Tuotemaara.Text = ""; Yhteishinta.Text = ""; foreach (MyyntiArtikkeli ma in TapahtumanMyyntiTapahtumat.ostoslista.myyntiArtikkelit) { Tuotenimi.Text = Tuotenimi.Text + ma.nimi + "\n"; Tuotemaara.Text = Tuotemaara.Text + ma.maara.ToString() + " " + Localization.GetLocalizedText("pcs") + "\n"; Yhteishinta.Text = Yhteishinta.Text + (ma.maara * ma.hinta).ToString() + " " + Settings.getCurrency() + "\n"; yht_hinta += (ma.maara * ma.hinta); SumBlock.Text = yht_hinta.ToString(); } EuroaBlock.Text = Settings.getCurrency(); } else { /* Problem */ throw new NotImplementedException(); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { BackStackClass.SetBackButtonVisibility(); if (e.Parameter != null) { if (e.NavigationMode == NavigationMode.Back) { if (e.Parameter is UseCaseType && (UseCaseType)e.Parameter == UseCaseType.jatkaPaivaa) { /* Asynkroninen operaatio ilman varoituksia. */ string s = Localization.GetLocalizedTextWithVariables("EventXStoppedInListMsg", Tapahtuma.getTapahtuma().nimi); Task task = new MessageDialog(s).ShowAsync().AsTask(); /* Sulje tapahtuma*/ Tapahtuma.hylkääTapahtuma(); } BackStackClass.Navigate(typeof(StartupProjected)); } if (e.Parameter is UseCaseType) { UseCase = (UseCaseType)e.Parameter; tapahtumat = await InputOutput.ReadTapahtumatFromXmlFilesAsyncToList("Tapahtuma"); listTapahtumat.ItemsSource = tapahtumat; /* List creates Tapahtuma objects and last read Tapahtuma is stored to static lastThis variable in Tapahtuma. It needs to be discarded. */ Tapahtuma.hylkääTapahtuma(); } else { /* Problem */ throw new NotImplementedException(); } if (UseCase == UseCaseType.poista) { ValmisButton.Content = Localization.GetLocalizedText("Delete"); ValmisButton.Background = new SolidColorBrush(Colors.Red); } } }