Example #1
0
        public new void Dispose()
        {
            ShowingMessages.Remove(this);

            if (ShowingMessage == this)
            {
                ShowingMessage = null;
                if (ShowingMessages.Count > 0)
                    ShowingMessage = ShowingMessages[0];
            }

            if (ShowingMessage != null)
            {
                ShowingMessage.txtMessage.Text = ShowingMessages[ShowingMessages.Count - 1].OriginalText;
                if (!ShowingMessage.Visible) //not dsplaying yet? we should do so now
                    ShowingMessage.Show();
            }
            else
            {
                Program.MainForm.Enabled = true; //we're done displaying
                Win32.LockWindowUpdate(IntPtr.Zero);
            }

            base.Dispose();
            Global.DoEvents(); //be sure we're completely un-drawn
        }
Example #2
0
        public static frmMessage Show(string Message)
        {
            frmMessage NewMessage = new frmMessage();
            NewMessage.txtMessage.Text = Message;
            NewMessage.OriginalText = Message;

            ShowingMessages.Add(NewMessage);

            if (ShowingMessage == null)
            {
                ShowingMessage = NewMessage;
                ShowingMessage.Show();
                Program.MainForm.Enabled = false;
                Global.DoEvents(); //be sure we're completely drawn
                Win32.LockWindowUpdate(Program.MainForm.Handle);
            }
            else
            {
                ShowingMessage.txtMessage.Text = Message;
                Global.DoEvents(); //be sure we're completely drawn
            }

            return NewMessage;
        }
Example #3
0
        void Provider_SearchResultsUpdated(ISearchProvider provider, UpdateReason Reason, string ErrorMessage)
        {
            this.Cursor = Cursors.Default;

            if (_BusyMessage != null)
            {
                _BusyMessage.Dispose();
                _BusyMessage = null;
            }

            //using (new LockWindowUpdate(NzbResultList.Handle))
            {
                BuildFilteredListIfNeeded();
                NzbResultList.Refresh();
            }

            switch (Reason)
            {
                case UpdateReason.NewSearch:
                    _ListCache.Clear();
                    NzbResultList.Refresh();
                    if (ErrorMessage == null && provider.SearchResultItemCount == 0)
                        ErrorMessage = "No items found with current search criteria";
                    if (ErrorMessage == null)
                        NzbResultList.Focus(); //move focus to list
                    break;

                case UpdateReason.MoreSearch:
                    //no refreshing of any kind
                    break;

                case UpdateReason.Sorting:
                    _ListCache.Clear();
                    NzbResultList.Refresh();
                    break;
            }

            if (ErrorMessage != null && ErrorMessage.Length > 0)
                MessageBox.Show(ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
Example #4
0
        void DoSearch()
        {
            _BusyMessage = frmMessage.Show("Searching, please wait...");

            _provider.ClearSearchResults();
            txtFilter.Text = string.Empty;   // will trigger a filter build, which is why we clear search results BEFORE doing this
            NzbResultList.VirtualListSize = 0; //at this point, should already be at 0, but just to be sure
            _FilteredList = null;           //should already be NULL at this point
            _ListCache.Clear();
            StartRefresh();

            if (_provider.SearchParams.Text != null && _provider.SearchParams.Text.Length > 0)
            {
                //add item to top of list in combobox
                if (cboSearch.Items.Contains(_provider.SearchParams.Text))
                    cboSearch.Items.Remove(_provider.SearchParams.Text);

                cboSearch.Items.Insert(0, _provider.SearchParams.Text);
                cboSearch.SelectedIndex = 0;

                while (cboSearch.Items.Count > 20) //keep total history items below 20
                    cboSearch.Items.RemoveAt(cboSearch.Items.Count - 1);
            }

            _provider.Search();
        }