Esempio n. 1
0
        public static void GetCardRulings(Filter filter, RunWorkerCompletedEventHandler completedDelegate)
        {
            Console.WriteLine("Call to GetCardInfo");

            if(bgWorker == null || !bgWorker.IsBusy)
            {
                bgWorker = new BackgroundWorker();
                bgWorker.DoWork += AsyncFindMatches;
                bgWorker.RunWorkerCompleted += completedDelegate;
                bgWorker.RunWorkerAsync(filter);
            }
        }
Esempio n. 2
0
 public static void GetImageUrl(Filter filter, RunWorkerCompletedEventHandler callback)
 {
     Console.WriteLine("Call to GetImageUrl");
     if (bgWorker == null || !bgWorker.IsBusy)
     {
         bgWorker = new BackgroundWorker();
         bgWorker.DoWork += new DoWorkEventHandler(AsyncGrabImage);
         bgWorker.WorkerSupportsCancellation = true;
         bgWorker.RunWorkerCompleted += callback;
         bgWorker.RunWorkerAsync(filter);
     }
 }
Esempio n. 3
0
        public MainView()
        {
            InitializeComponent();

            filter = new Filter();
            blurTimer = new Timer();
            blurTimer.Tick += new EventHandler(BlurTimer_Tick);

            toolStripStatusLabel1.Text = "";

            viewCardList = new SortableBindingList<CardCollectionCard>();
            dataGridView1.DataSource = viewCardList;
            dataGridView1.MouseUp += new MouseEventHandler(dataGridView1_MouseUp);
            dataGridView1.CellValueChanged += new DataGridViewCellEventHandler(dataGridView1_CellValueChanged);
            dataGridView1.RowsAdded += new DataGridViewRowsAddedEventHandler(dataGridView1_RowsAdded);
            dataGridView1.DataError +=new DataGridViewDataErrorEventHandler(dataGridView1_DataError);
            dataGridView1.EnableHeadersVisualStyles = true;
            InitializeDataGridView();

            checkBoxW.CheckedChanged += new EventHandler(FilterCheckbox_CheckedChanged);
            checkBoxU.CheckedChanged += new EventHandler(FilterCheckbox_CheckedChanged);
            checkBoxB.CheckedChanged += new EventHandler(FilterCheckbox_CheckedChanged);
            checkBoxR.CheckedChanged += new EventHandler(FilterCheckbox_CheckedChanged);
            checkBoxG.CheckedChanged += new EventHandler(FilterCheckbox_CheckedChanged);

            comboBox1.TextChanged += textBox1_TextChanged;

            toolStripStatusLabel1.Text = "Loading card base";
            Rulings.LoadCache();
            toolStripStatusLabel1.Text = "Card base loaded";

            // application settings
            this.AUTOCOMPLETE_SUGGESTIONS = Properties.Settings.Default.AutocompleteSuggestions;
            this.BLUR_DELAY = Properties.Settings.Default.BlurDelay;
            blurTimer.Interval = this.BLUR_DELAY;

            Rulings.DateCacheExpires = Properties.Settings.Default.CacheExpirationDate;
            Rulings.RulingsCache = new Uri(Properties.Settings.Default.CachePath, (Properties.Settings.Default.CachePathIsRelative ? UriKind.Relative : UriKind.Absolute));
            Rulings.RulingSource = new Uri(Properties.Settings.Default.RulingSourceUrl);
            Rulings.ExpirationInterval = Properties.Settings.Default.CacheExpirationInterval;
        }
Esempio n. 4
0
        void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0
                && dataGridView1.SelectedRows[0].Cells.Count > 0
                && dataGridView1.SelectedRows[0].Cells[0].Value != null)
            {

                toolStripStatusLabel1.Text = "Fetching image";
                Filter newFilter = new Filter() { CardName = dataGridView1.SelectedRows[0].Cells[1].Value.ToString() };
                ImageGrabber.GetImageUrl(newFilter, UpdatePictureBox_Completed);
            }
            else if (dataGridView1.SelectedCells.Count == 1
                && dataGridView1.SelectedCells[0].Value != null)
            {
                toolStripStatusLabel1.Text = "Fetching image";
                Filter newFilter = new Filter() { CardName = dataGridView1.SelectedCells[0].Value.ToString() };
                ImageGrabber.GetImageUrl(newFilter, UpdatePictureBox_Completed);
            }
        }