Example #1
0
        void WriteCraftToHistory()
        {
            Craft craft = new Craft(_resultPrice, _outcomePrice, _resultFloat, DateTime.Now.Date.ToShortDateString());

            if (steamItemOverlayURL == "")
            {
                CraftHistoryHandler.AddCraft(craft);
                CraftHistoryHandler.Save();
            }
            else if (IsSteamOverlayURLValid(steamItemOverlayURL))
            {
                if (!WebController.CheckConnection())
                {
                    MessageBox.Show((string)Application.Current.Resources["NetworkDisable"]);
                    return;
                }
                Scin scin = JsonSerializer.Deserialize <Scin>(WebController.GetItemProp(steamItemOverlayURL));
                craft.imageUrl    = scin.imageurl;
                craft.outcomeName = scin.full_item_name;
                craft.rarity      = scin.rarity;
                CraftHistoryHandler.AddCraft(craft);
                CraftHistoryHandler.Save();
            }
            else
            {
                if (MessageBoxResult.Yes.Equals(MessageBox.Show((string)Application.Current.Resources["ErrorSteamOverlayURLWrongTitle"], (string)Application.Current.Resources["ErrorSteamOverlayURLWrongText"], MessageBoxButton.YesNo, MessageBoxImage.Error)))
                {
                    CraftHistoryHandler.AddCraft(craft);
                    CraftHistoryHandler.Save();
                }
            }
        }
        public TradeUpPage()
        {
            InitializeComponent();
            DataContext = new TradeUpPageVM();
            this.Title  = "TradeUp Helper";


            FloatTextBoxes = new List <TextBox>()
            {
                tb_float1, tb_float2, tb_float3, tb_float4, tb_float5, tb_float6, tb_float7, tb_float8, tb_float9, tb_float10
            };
            PriceTextBoxes = new List <TextBox>()
            {
                tb_price1, tb_price2, tb_price3, tb_price4, tb_price5, tb_price6, tb_price7, tb_price8, tb_price9, tb_price10
            };

            CraftHistoryHandler.Load();
        }