Esempio n. 1
0
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         System.Diagnostics.Process.Start(linkLabel1.Text);
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(ex);
     }
 }
 private void UpdateResources()
 {
     try
     {
         this.LocationHeader.Text = Resources.LocationTxt;
         this.CancelBtn.Text      = Resources.CancelTxt;
         this.NameHeader.Text     = Resources.NameTxt;
         this.VersionHeader.Text  = Resources.VersionTxt;
         this.CopyBtn.Text        = Resources.CopyTxt;
         this.Text = Resources.LibraryVersionsTxt;
         //Update help strings from the resource.
         this.helpProvider1.SetHelpString(this.listView1, Resources.LibraryListHelp);
         this.helpProvider1.SetHelpString(this.CopyBtn, Resources.CopyTxt);
         this.helpProvider1.SetHelpString(this.CancelBtn, Resources.ClosesTheDialogBoxWithoutSavingAnyChangesYouHaveMade);
     }
     catch (Exception Ex)
     {
         GXCommon.ShowError(Ex);
     }
 }
Esempio n. 3
0
 private void OKBtn_Click(object sender, EventArgs e)
 {
     try
     {
         bool updatesAvailable = false;
         foreach (ListViewItem it in listView1.Items)
         {
             GXAddIn addIn = it.Tag as GXAddIn;
             if (addIn.State == AddInStates.Available || addIn.State == AddInStates.Update)
             {
                 updatesAvailable = true;
             }
             //If user has select items to download do not notify.
             else if (addIn.State == AddInStates.Download)
             {
                 updatesAvailable = false;
                 break;
             }
         }
         DialogResult res = DialogResult.Yes;
         if (updatesAvailable)
         {
             res = MessageBox.Show(this, Resources.NewProtocolsDownloadTxt, Resources.NewProtocolsAvailableTxt, MessageBoxButtons.YesNoCancel);
             if (res != DialogResult.Yes)
             {
                 this.DialogResult = DialogResult.OK;
                 this.Close();
                 return;
             }
         }
         //Add downloadable items to the list or they are not shown anymore.
         foreach (ListViewItem it in listView1.Items)
         {
             GXAddIn addIn = it.Tag as GXAddIn;
             if (addIn.State == AddInStates.Available ||
                 addIn.State == AddInStates.Download)
             {
                 if (addIn.State == AddInStates.Available)
                 {
                     if (res == DialogResult.Yes)
                     {
                         addIn.State = AddInStates.Download;
                     }
                     else if (res == DialogResult.No)
                     {
                         addIn.State = AddInStates.Disabled;
                     }
                 }
                 //Add new Addins.
                 bool exists = false;
                 foreach (var a in AddIns)
                 {
                     if (a.Name == addIn.Name)
                     {
                         exists = true;
                         break;
                     }
                 }
                 if (!exists)
                 {
                     AddIns.Add(addIn);
                 }
             }
         }
         XmlWriterSettings settings = new XmlWriterSettings();
         settings.Indent          = true;
         settings.Encoding        = System.Text.Encoding.UTF8;
         settings.CloseOutput     = true;
         settings.CheckCharacters = false;
         string path = System.IO.Path.Combine(GXCommon.ProtocolAddInsPath, "updates.xml");
         DataContractSerializer x = new DataContractSerializer(typeof(GXAddInList));
         using (XmlWriter writer = XmlWriter.Create(path, settings))
         {
             x.WriteObject(writer, AddIns);
             writer.Close();
         }
         Gurux.Common.GXFileSystemSecurity.UpdateFileSecurity(path);
         GXUpdateChecker updater = new GXUpdateChecker();
         updater.OnProgress += new GXUpdateChecker.ProgressEventHandler(updater_OnProgress);
         Status              = updater.UpdateProtocols();
         updater.UpdateApplications();
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(this, ex);
     }
 }