Beispiel #1
0
        /// <summary>
        /// Initializes the instance of this MainView.
        /// Because error logging mechanism uses the MainView's console, it needs to be called only after the handle for the window
        /// has been created --> during the "Load" event or later (after the form has been created and shown).
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void initialize(object sender, EventArgs e)
        {
            Config         = new MKMToolConfig();
            timer.Interval = 1440 * 1000 * 60; // set the interval to one day (1440 minutes in ms)
            try
            {
                var doc2 = MKMInteract.RequestHelper.getAccount();

                if (Config.MyCountryCode == "") // signifies user wants auto-detect, otherwise the chosen setting overrides what we get from MKM
                {
                    Config.MyCountryCode = doc2["response"]["account"]["country"].InnerText;
                }
                MKMHelpers.sMyId = doc2["response"]["account"]["idUser"].InnerText;
            }
            catch (Exception eError)
            {
                MKMHelpers.LogError("initializing product list and account info", eError.Message, true);
            }
            bot                      = new MKMBot();
            settingsWindow           = new UpdatePriceSettings("LastSettingsPreset", "Settings of Update Price");
            stockViewWindow          = new StockView();
            checkCheapDealsWindow    = new CheckWantsView();
            checkDisplayPricesWindow = new CheckDisplayPrices();
            wantlistEditorViewWindow = new WantlistEditorView();
            priceExternalListWindow  = new PriceExternalList();
        }
Beispiel #2
0
        public MainView()
        {
            InitializeComponent();

#if DEBUG
            logBox.AppendText("DEBUG MODE ON!\n");
#endif
            try
            {
                if (!File.Exists(@".\\config.xml"))
                {
                    MessageBox.Show("No config file found! Create a config.xml first.");

                    Application.Exit();
                }

                MKMHelpers.GetProductList();

                var doc2 = MKMInteract.RequestHelper.getAccount();

                MKMHelpers.sMyOwnCountry = doc2["response"]["account"]["country"].InnerText;
                MKMHelpers.sMyId         = doc2["response"]["account"]["idUser"].InnerText;

                bot = new MKMBot();
            }
            catch (Exception eError)
            {
                MessageBox.Show(eError.Message);
            }
        }
Beispiel #3
0
        private void downloadBuysToExcel_Click(object sender, EventArgs e)
        {
            logBox.AppendText("Downloading Buys data." + Environment.NewLine);

            string sFilename = MKMBot.GetBuys(this, "8"); //mainForm

            if (sFilename != "")
            {
                Process.Start(sFilename);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Initializes the instance of this MainView.
        /// Because error logging mechanism uses the MainView's console, it needs to be called only after the handle for the window
        /// has been created --> during the "Load" event or later (after the form has been created and shown).
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void initialize(object sender, EventArgs e)
        {
            timer.Interval = 1440 * 1000 * 60; // set the interval to one day (1440 minutes in ms)
            try
            {
                var doc2 = MKMInteract.RequestHelper.getAccount();

                MKMHelpers.sMyOwnCountry = doc2["response"]["account"]["country"].InnerText;
                MKMHelpers.sMyId         = doc2["response"]["account"]["idUser"].InnerText;
            }
            catch (Exception eError)
            {
                MKMHelpers.LogError("initializing product list and account info", eError.Message, true);
            }
            bot = new MKMBot();
        }
Beispiel #5
0
        private void wantsListBoxReload()
        {
            try
            {
                var bot = new MKMBot();

                var sListId = (wantListsBox.SelectedItem as MKMHelpers.ComboboxItem).Value.ToString();

                wantsView.Columns.Clear();

                var ds = bot.buildProperWantsList(sListId);

                if (ds.Select().Length > 0)
                {
                    wantsView.AutoGenerateColumns = true;
                    wantsView.DataSource          = ds;

                    wantsView.Refresh();

                    wantsView.Columns["idProduct"].Visible    = false;
                    wantsView.Columns["Category ID"].Visible  = false;
                    wantsView.Columns["Expansion ID"].Visible = false;
                    wantsView.Columns["Date Added"].Visible   = false;
                    wantsView.Columns["idExpansion"].Visible  = false;
                    wantsView.Columns["abbreviation"].Visible = false;
                    wantsView.Columns["idWant"].Visible       = false;
                    wantsView.Columns["item_Id"].Visible      = false;
                    wantsView.Columns["wantslist_Id"].Visible = false;
                    wantsView.Columns["type"].Visible         = false;
                    wantsView.Columns["wishPrice"].Visible    = false;
                    wantsView.Columns["count"].Visible        = false;

                    wantsView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                    wantsView.ReadOnly            = true;
                }
            }
            catch (Exception eError)
            {
                MessageBox.Show(eError.ToString());
            }
        }
Beispiel #6
0
 /// <summary>
 /// Resets all GUI controls to default values.
 /// </summary>
 public void ResetToDefault()
 {
     UpdateSettingsGUI(MKMBot.GenerateDefaultSettings());
 }