Beispiel #1
0
 void refreshAddinFields(AddinConfig selectedConfig)
 {
     this.nameTextBox.Text     = selectedConfig.name;
     this.fileTextBox.Text     = selectedConfig.dllPath;
     this.versionTextBox.Text  = selectedConfig.version;
     this.loadCheckBox.Checked = selectedConfig.load;
 }
		private void addConfigToListView(AddinConfig addinConfig)
		{
			//add it to the view
			ListViewItem item = new ListViewItem(addinConfig.name);
			item.Tag = addinConfig;
			item.SubItems.Add(addinConfig.load.ToString());
			this.addinsListView.Items.Add(item);
		}
Beispiel #3
0
        private void addConfigToListView(AddinConfig addinConfig)
        {
            //add it to the view
            ListViewItem item = new ListViewItem(addinConfig.name);

            item.Tag = addinConfig;
            item.SubItems.Add(addinConfig.load.ToString());
            this.addinsListView.Items.Add(item);
        }
		/// <summary>
		/// load a single addin as defined by the given config
		/// </summary>
		/// <param name="addinConfig">the config for the addin to load</param>
		private void loadAddin(AddinConfig addinConfig)
		{
			//first make sure we have the last version
			this.copyAddinToLocalFolder(addinConfig,false);
			string addinPath = this.config.getLocalAddinPath(addinConfig);
			if (addinConfig.load && File.Exists(addinPath))
			{
				addins.Add(new EAAddinFramework.EASpecific.EAAddin(addinPath, addinConfig.name));
			}
		}
Beispiel #5
0
 void LoadCheckBoxCheckedChanged(object sender, EventArgs e)
 {
     if (this.addinsListView.SelectedItems.Count == 1)
     {
         AddinConfig selectedConfig = (AddinConfig)this.addinsListView.SelectedItems[0].Tag;
         selectedConfig.load = this.loadCheckBox.Checked;
     }
     else
     {
         this.loadCheckBox.Checked = false;
     }
 }
Beispiel #6
0
        void AddAddinButtonClick(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = getAddinFileDialog("Select a new add-in dll", string.Empty);

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                AddinConfig newConfig = this.addinManager.loadAddin(openFileDialog.FileName);
                this.config.addinConfigs.Add(newConfig);
                this.addConfigToListView(newConfig);
                //select the last one
                this.addinsListView.Items[this.addinsListView.Items.Count - 1].Selected = true;
            }
        }
Beispiel #7
0
 void BrowseFileButtonClick(object sender, EventArgs e)
 {
     if (this.addinsListView.SelectedItems.Count == 1)
     {
         AddinConfig    currentConfig  = (AddinConfig)this.addinsListView.SelectedItems[0].Tag;
         OpenFileDialog openFileDialog = getAddinFileDialog("Select the add-in dll", currentConfig.directory);
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             currentConfig = this.addinManager.loadAddin(openFileDialog.FileName);
             //show the new fields
             this.refreshAddinFields(currentConfig);
         }
     }
 }
Beispiel #8
0
        void AddinsListViewItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            AddinConfig selectedConfig = (AddinConfig)e.Item.Tag;

            if (e.IsSelected)
            {
                this.refreshAddinFields(selectedConfig);
            }
            else
            {
                this.nameTextBox.Text     = string.Empty;
                this.fileTextBox.Text     = string.Empty;
                this.versionTextBox.Text  = string.Empty;
                this.loadCheckBox.Checked = false;
            }
        }
		/// <summary>
		/// copy the remote addin files to the local folder
		/// </summary>
		/// <param name="addinConfig">the addin config to copy the files for</param>
		/// <param name="alwaysCopy">if false then only copy if remote version is newer</param>
		private void copyAddinToLocalFolder(AddinConfig addinConfig, bool alwaysCopy)
		{
			string localDllPath = this.config.getLocalAddinPath(addinConfig);
			foreach (string addinSearchPath in this.config.addinSearchPaths) 
			{
				string remoteDllPath = this.config.getRemoteAddinPath(addinConfig, addinSearchPath);
				if (File.Exists (remoteDllPath))
				{
					//found the right folder
					if (alwaysCopy || this.remoteVersionIsNewer(remoteDllPath,localDllPath))
					{
						//copy the remote folder over the local folder
						directoryCopy(addinSearchPath + addinConfig.name ,this.config.localAddinPath +  addinConfig.name , true);
					}
				}
			}
		}
Beispiel #10
0
        void BrowseNameButtonClick(object sender, EventArgs e)
        {
            if (this.addinsListView.SelectedItems.Count > 0)
            {
                AddinConfig currentConfig = (AddinConfig)this.addinsListView.SelectedItems[0].Tag;
                // Create an instance of the open file dialog box.
                FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
                //set the initial directory
                folderBrowserDialog.SelectedPath = currentConfig.directory;

                if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
                {
                    currentConfig.directory = folderBrowserDialog.SelectedPath;
                    //update fields
                    this.refreshAddinFields(currentConfig);
                }
            }
        }
		void refreshAddinFields(AddinConfig selectedConfig)
		{
			this.nameTextBox.Text = selectedConfig.name;
			this.fileTextBox.Text = selectedConfig.dllPath;
			this.versionTextBox.Text = selectedConfig.version;
			this.loadCheckBox.Checked = selectedConfig.load;
		}
		/// <summary>
		/// load an addin based on a filepath
		/// </summary>
		/// <param name="filePath">the filepath to the addin dll</param>
		/// <returns></returns>
		internal AddinConfig loadAddin(string filePath)
		{
			AddinConfig addinConfig = new AddinConfig(filePath);
			this.loadAddin(addinConfig);
			return addinConfig;
		}
Beispiel #13
0
 public string getRemoteAddinPath(AddinConfig addinConfig, string remotePath)
 {
     return(remotePath + addinConfig.name + "\\" + addinConfig.dllPath);
 }
Beispiel #14
0
 public string getLocalAddinPath(AddinConfig addinConfig)
 {
     return(localAddinPath + addinConfig.name + "\\" + addinConfig.dllPath);
 }
		public string getRemoteAddinPath (AddinConfig addinConfig, string remotePath)
		{
			return remotePath +  addinConfig.name + "\\" + addinConfig.dllPath;
		}
		public string getLocalAddinPath (AddinConfig addinConfig)
		{
			return localAddinPath +  addinConfig.name + "\\" + addinConfig.dllPath;
		}