コード例 #1
0
        private void SaatuTextChanged(object sender, TextChangedEventArgs e)
        {
            string s = SaatuBox.Text;
            float  saatu;
            float  takaisin;
            float  summa;

            if (s != "")
            {
                bool isNumeric = float.TryParse(s, out saatu);
                if (isNumeric)
                {
                    SaatuBoxOkString = s;
                    isNumeric        = float.TryParse(SumBlock.Text, out summa);
                    if (isNumeric)
                    {
                        takaisin         = saatu - summa;
                        ErotusBlock.Text = takaisin.ToString();
                        BackStackClass.WindowNotify("saatu", saatu.ToString());
                        BackStackClass.WindowNotify("Erotus", takaisin.ToString());
                    }
                }
                else
                {
                    SaatuBox.Text            = SaatuBoxOkString;
                    SaatuBox.SelectionStart  = SaatuBox.Text.Length; // Sets the cursor to the end of the text
                    SaatuBox.SelectionLength = 0;                    // Sets the cursor to the end of the text
                    BackStackClass.WindowNotify("saatu", SaatuBoxOkString);
                }
            }
            else // s == ""
            {
                BackStackClass.WindowNotify("saatu", "");
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
     BackStackClass.Navigate(typeof(StartupProjected));
     mainTimer          = new DispatcherTimer();
     mainTimer.Tick    += mainTimer_Tick;
     mainTimer.Interval = TimeSpan.FromMilliseconds(50);
     mainTimer.Start();
 }
コード例 #4
0
ファイル: Laskin.xaml.cs プロジェクト: hokpe/Kiosk-Calculator
 private void CancelClick(object sender, RoutedEventArgs e)
 {
     foreach (MyyntiArtikkeli ma in tapahtuma.myyntitapahtuma.ostoslista.myyntiArtikkelit)
     {
         ma.maara = 0;
     }
     BackStackClass.WindowNotify(null, null);
     UpdatePage();
 }
コード例 #5
0
 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();
 }
コード例 #6
0
ファイル: Laskin.xaml.cs プロジェクト: hokpe/Kiosk-Calculator
        private void LisaaTuotettaClick(object sender, RoutedEventArgs e)
        {
            MyyntiArtikkeli ma = (MyyntiArtikkeli)listArtikkelit.SelectedItem;

            if (ma != null)
            {
                ma.maara++;
                BackStackClass.WindowNotify(null, null);
                UpdatePage();
            }
        }
コード例 #7
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            Frame rootFrame = Window.Current.Content as Frame;

            while (rootFrame.BackStackDepth != 0)
            {
                /* MainPage is the initial page, if BackStack contains some pages, those needs to be removed. Like Startup Page. */
                this.Frame.BackStack.Remove(this.Frame.BackStack.Last());
            }
            BackStackClass.Navigate(typeof(StartupProjected));
        }
コード例 #8
0
        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();
            }
        }
コード例 #9
0
ファイル: Laskin.xaml.cs プロジェクト: hokpe/Kiosk-Calculator
        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();
            }
        }
コード例 #10
0
        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();
            }
        }
コード例 #11
0
        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);
                }
            }
        }
コード例 #12
0
 public TapahtumaLista()
 {
     this.InitializeComponent();
     BackStackClass.DefineBack();
 }
コード例 #13
0
 public Settings()
 {
     this.InitializeComponent();
     BackStackClass.DefineBack();
 }
コード例 #14
0
        public HinnastoJaArtikkelit()
        {
            this.InitializeComponent();

            BackStackClass.DefineBack();
        }