Exemplo n.º 1
0
        /// <summary>
        /// Metoda pokazuje okno rejestracji nowego konta
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void rejestracjaButton_Click(object sender, RoutedEventArgs e)
        {
            Window w = new Window2();

            w.ShowDialog();
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            myLogger.Info("GUI was started");


            InitializeComponent();
            DataContext = this;
            Window2 window2 = new Window2(this);

            window2.Show();
            using (StreamReader rd = new StreamReader("..\\history.txt"))
            {
                String text = rd.ReadToEnd();
                //MessageBox.Show(text);
                try
                {
                    // MessageBox.Show(text.Substring(0, text.IndexOf("\n")));
                    while (text != null)
                    {
                        if (text.Substring(0, text.IndexOf("\n")).Trim().Equals("Request"))
                        {
                            text = text.Substring(text.IndexOf("\n") + 1);

                            string type = text.Substring(0, text.IndexOf("\n"));
                            text = text.Substring(text.IndexOf("\n") + 1).Trim();
                            int id = Convert.ToInt32(text.Substring(0, text.IndexOf("\n")));
                            text = text.Substring(text.IndexOf("\n") + 1).Trim();
                            int amount = Convert.ToInt32(text.Substring(0, text.IndexOf("\n")));
                            text = text.Substring(text.IndexOf("\n") + 1).Trim();
                            int price = Convert.ToInt32(text.Substring(0, text.IndexOf("\n")));
                            text = text.Substring(text.IndexOf("\n") + 1).Trim();
                            int commodity = Convert.ToInt32(text.Substring(0, text.IndexOf("\n")));
                            text = text.Substring(text.IndexOf("\n") + 1).Trim();
                            bool isAMA = false;
                            if (text.Substring(0, text.IndexOf("\n") + 1).Trim().Equals("true"))
                            {
                                isAMA = true;
                            }
                            text = text.Substring(text.IndexOf("\n") + 1).Trim();
                            string date;
                            if (text.IndexOf("\n") == -1)
                            {
                                date = text;
                                text = null;
                            }
                            else
                            {
                                date = text.Substring(0, text.IndexOf("\n"));
                                text = text.Substring(text.IndexOf("\n") + 1).Trim();
                            }
                            HistoryItem h = new HistoryItem(type, id, amount, price, commodity, isAMA, date);
                            History.Insert(0, h);
                        }
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                }
            }
        }