Пример #1
0
        private void loadAllItems()
        {
            new Thread(() =>                 //creating a new thread, so that u can still interact with the UI
            {
                this.Dispatcher.Invoke(() => //gives the button free, from the máin thread
                {
                    refresh.Content   = "loading";
                    refresh.IsEnabled = false;
                });


                MySteamItems.UpdateAllItems();


                this.Dispatcher.Invoke(() =>
                {
                    refresh.Content   = "refresh";
                    refresh.IsEnabled = true;
                    loadMySteamItems();
                    loadConclusion();
                    updateCharData();
                    CartesianMonth();
                });
            }).Start();
        }
Пример #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MySteamItems.removeJsonItem((this.Parent as StackPanel).Children.IndexOf(this));//removes item from MySteamItems.json list


            (this.Parent as StackPanel).Children.Remove(this);// removes the item froom the usercontrol
        }
Пример #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool everythingIsCorrect = true;

            everythingIsCorrect          = true;
            nameLabel.Foreground         = (Brush)bc.ConvertFrom("#f5f6fa");
            quantityLabel.Foreground     = (Brush)bc.ConvertFrom("#f5f6fa");
            pricePerItemLabel.Foreground = (Brush)bc.ConvertFrom("#f5f6fa");
            priceGoalLabel.Foreground    = (Brush)bc.ConvertFrom("#f5f6fa");
            quantityLabel.Foreground     = (Brush)bc.ConvertFrom("#f5f6fa");
            nameLabel.Foreground         = (Brush)bc.ConvertFrom("#f5f6fa");



            if (quantityCheck() == false)
            {
                quantityLabel.Foreground = (Brush)bc.ConvertFrom("#e84118");
                everythingIsCorrect      = false;
            }
            if (checkPrice() == false)
            {
                pricePerItemLabel.Foreground = (Brush)bc.ConvertFrom("#e84118");
                everythingIsCorrect          = false;
            }
            if (checkPriceGoal() == false)
            {
                priceGoalLabel.Foreground = (Brush)bc.ConvertFrom("#e84118");
                everythingIsCorrect       = false;
            }

            if (everythingIsCorrect == true)
            {
                string name      = ItemNameWPF.Text;
                string condition = getSelectcetdCondition();
                var    price     = GetSteamItems.GetItemPriceForAddItem(name, condition);


                if (price.Result != null)
                {
                    Debug.WriteLine("price (AddITemClass) ist != null");
                    Item item = new Item(ItemNameWPF.Text, getSelectcetdCondition(), quantityWPF.Text, pricePerItemWPF.Text, priceGoalWPF.Text, price.Result); //Creates a new item
                    sp.Children.Add(item);

                    //save item in Array
                    SteamItemJson JsonItem = new SteamItemJson();
                    JsonItem.itemName      = ItemNameWPF.Text;
                    JsonItem.itemQuantity  = quantityWPF.Text;
                    JsonItem.ItemBuyPrice  = pricePerItemWPF.Text;
                    JsonItem.ItemPriceGoal = priceGoalWPF.Text;
                    JsonItem.itemCondition = getSelectcetdCondition();
                    JsonItem.itemPrice     = price.Result;

                    MySteamItems.AddItemToJSON(JsonItem);
                    this.Close();
                }
            }
        }