Esempio n. 1
0
        /// <summary>
        /// Fires when user opens pop-up window with a list of available oredrs.
        /// </summary>
        /// <param name="sender">The button New that the action is for.</param>
        /// <param name="e">Arguments that the implementor of this event may find useful.</param>
        private void ExploreOrders(object sender, RoutedEventArgs e)
        {
            var orders = _storage.RetrieveAllIds();

            if (orders.Count > 0)
            {
                OrdersList.ItemsSource = orders;
                OrdersExplorer.IsOpen  = true;
                ResetOrderInstance();
                WindowMain.IsEnabled       = false;
                EditOrderButton.IsEnabled  = false;
                DeletOrderButton.IsEnabled = false;
                Opacity = 0.5;
                Effect  = new BlurEffect();
            }
            else
            {
                Util.Info("Explore orders", "Orders database is empty!");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Parameterless constructor of application's main window.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            EditOrderButton.IsEnabled  = false;
            DeletOrderButton.IsEnabled = false;
            try
            {
                _storage = new OrdersStorage("storage.xml");
                _storage.CreateIfNotExists();
                var ordersList = _storage.RetrieveAllIds();
                _nextId = ordersList.Count != 0 ? ordersList.Keys.Last() + 1 : 0;
            }
            catch (NullReferenceException e)
            {
                Util.Error("Storage fatal error", e.Message);
                Application.Current.Shutdown();
            }
            this.DataContext = _order;
            _validator       = new Validator(
                new List <TextBox>
            {
                FirstName,
                LastName,
                Email,
                PhoneNumber,
                ClientAddressCity,
                ClientAddressStreet,
                ClientAddressBuildingNumber,
                ShopName,
                ShopAddressCity,
                ShopAddressStreet,
                ShopAddressBuildingNumber,
                GoodsCode,
                GoodsWeight
            },
                Email,
                PhoneNumber);
            ResetOrderInstance();
            Closing += new System.ComponentModel.CancelEventHandler((object sender, System.ComponentModel.CancelEventArgs e) =>
            {
                OnWindowClose(sender, e);
                if (cans)
                {
                    e.Cancel = true;
                }
            });
            _instance = this;
            SetTextBoxAction();
            setUpdater();
        }