Esempio n. 1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            if (lstAssemblies.Items.Count == 0)
            {
                MessageBox.Show("Please select assemblies first!", "Empty items", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (SelectFile())
                {
                    foreach (string s in this.FileName)
                    {
                        if (lstAssemblies.FindString(s) == -1)
                        {
                            lstAssemblies.Items.Add(s);
                        }
                        else
                        {
                            MessageBox.Show("Duplicate assembly." + "\n" + "Please select another one!", "Existing Item", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
            foreach (var item in lstAssemblies.Items)
            {
                if (RegisteryHelper.Create(item.ToString(), autoCADVersion))
                {
                    //lstAssemblies.Items.Remove(item);

                    MessageBox.Show(Path.GetFileNameWithoutExtension(item.ToString()) + " was added to registery!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(Path.GetFileNameWithoutExtension(item.ToString()) + "was not added to registery!", "Fail!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            ListBox       list       = new ListBox();
            List <string> assemblies = RegisteryHelper.ReadAssemblies(this.autoCADVersion);

            foreach (string s in assemblies)
            {
                list.Items.Add(s);
            }

            AssembliesManager assembliesManager = new AssembliesManager();

            assembliesManager.StartPosition  = FormStartPosition.CenterParent;
            assembliesManager.Assemblies     = assemblies;
            assembliesManager.AutoCADVersion = this.autoCADVersion;
            assembliesManager.Setup();
            assembliesManager.ShowDialog();
        }
Esempio n. 3
0
        private void btnUnload_Click(object sender, EventArgs e)
        {
            RegistryKey currentKey = Registry.CurrentUser.OpenSubKey(RegisteryHelper.KeyFromAutoCADVersion(this.AutoCADVersion), true);

            if (!IsReadonly(lstAssemblies.SelectedItem.ToString()))
            {
                DialogResult rs = MessageBox.Show("Do you want to unload: " + lstAssemblies.SelectedItem.ToString(), "Unload Assembly?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (rs == System.Windows.Forms.DialogResult.Yes)
                {
                    currentKey.DeleteSubKey(lstAssemblies.SelectedItem.ToString());
                    currentKey.Close();

                    for (int x = lstAssemblies.SelectedIndices.Count - 1; x >= 0; x--)
                    {
                        int idx = lstAssemblies.SelectedIndices[x];
                        lstAssemblies.Items.RemoveAt(idx);
                    }
                }
            }
            else
            {
                MessageBox.Show("This assembly is readonly!", "Readonly!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }