示例#1
0
 public ComponentDetailsDialog(IServiceProvider provider, ComponentDescription comp, ComponentGalleryServiceProxy service)
     : base(provider)
 {
     this._component = comp;
     this._service = service;
     this.InitializeComponent();
     if (this._component.Glyph != null)
     {
         this._icon = new Icon(new MemoryStream(this._component.Glyph));
     }
     this._nameLabel.Text = this._component.Name;
     this._authorLabel.Text = "Author : " + this._component.Author;
     this._versionLabel.Text = "Version " + this._component.Version;
     this._descriptionTextBox.Text = this._component.ShortDescription;
     this._dateReleasedLabel.Text = this._component.DateReleased.ToString();
     this._downloadCountLabel.Text = this._component.DownloadCount.ToString();
     this._ratingLabel.Text = string.Format("{0:f1} based on " + this._component.RatingCount + " reviews", this._component.AverageRating);
     this._packageContentsTextBox.Text = this._component.PackageContents;
     this._discussionUrlLinkLabel.Text = this._component.DiscussionForumUrl;
     this._descriptionUrlLinkLabel.Text = this._component.FullDescriptionUrl;
     this._sizeLabel.Text = string.Format("{0:N0} bytes", this._component.Size);
     this._detailTabControl.SelectedIndexChanged += new EventHandler(this.OnDetailTabControlSelectedIndexChanged);
     this._reviewsDownloaded = false;
     this._nameLabel.Font = new Font(this.Font, FontStyle.Bold);
     if (this._icon != null)
     {
         this._imagePictureBox.Image = this._icon.ToBitmap();
     }
 }
示例#2
0
 private void OnGetCategoriesDone(IAsyncResult result)
 {
     try
     {
         CategoryInfo[] infoArray = this._newService.EndGetCategories(result);
         this._service = this._newService;
         this._resultsListView.Items.Clear();
         this._categoryListView.Items.Clear();
         for (int i = 0; i < infoArray.Length; i++)
         {
             this._categoryListView.Items.Add(new CategoryInfoListViewItem(infoArray[i]));
         }
         this._categoryListView.Enabled = true;
         this._searchButton.Enabled = true;
         this._keywordComboBox.Enabled = true;
         string text = this._galleryComboBox.Text;
         this.ConnectMruList.AddEntry(text);
         this._galleryComboBox.Items.Clear();
         this._galleryComboBox.Items.AddRange(this.ConnectMruList.Save());
         this._galleryComboBox.SelectedIndex = 0;
     }
     catch (InvalidOperationException)
     {
         MessageBox.Show(this, "The URL did not contain a valid WebService.  Please check your URL and try again", "Component Gallery", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     catch (Exception exception)
     {
         if (!this._aborted)
         {
             MessageBox.Show(this, exception.Message, "Component Gallery", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
         else
         {
             this._aborted = false;
         }
     }
     finally
     {
         this._newService = null;
         this.Connecting = false;
     }
 }
示例#3
0
 private void OnCancelButtonClick(object sender, EventArgs e)
 {
     if (this.Connecting)
     {
         this._aborted = true;
         this._newService.Abort();
         this._newService = null;
         this.Connecting = false;
     }
     base.DialogResult = DialogResult.Cancel;
     base.Close();
 }
示例#4
0
 private void OnConnectButtonClick(object sender, EventArgs e)
 {
     if (this.Connecting)
     {
         this._aborted = true;
         this._newService.Abort();
         this._newService = null;
         this.Connecting = false;
     }
     else
     {
         this.ConnectToGallery();
     }
 }
示例#5
0
 private void ConnectToGallery()
 {
     string url = this._galleryComboBox.Text.Trim();
     if ((this._service == null) || ((this._service.Url != url) && (url.Length > 0)))
     {
         this.Connecting = true;
         try
         {
             this._newService = new ComponentGalleryServiceProxy(url);
         }
         catch (UriFormatException)
         {
             MessageBox.Show(this, "Invalid URL.  Please check your URL and try again.", "Component Gallery", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             return;
         }
         this._categoryListView.Items.Clear();
         this._newService.BeginGetCategories(this.TypeFilter, new AsyncCallback(this.OnGetCategoriesDone), this._service);
     }
 }