示例#1
0
 public SelectPop(string name, string fileLoc, string imgLoc)
 {
     InitializeComponent();
     pro = new ProgramContainer(name, fileLoc, imgLoc);
     this.nameTextBox.Text = name;
     this.imgLocText.Text  = imgLoc;
     this.imgLoc           = imgLoc;
     this.exeLoc           = fileLoc;
     this.programText.Text = fileLoc;
 }
示例#2
0
文件: Program.cs 项目: CocebanVlad/DI
        static void Main(string[] args)
        {
            var container = new ProgramContainer();

            container.Init();

            var animal = container.Kernel.Resolve <IAnimal>();

            animal.MakeSound();
        }
示例#3
0
        private void startHubList_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int index = this.startHubList.IndexFromPoint(e.Location);

            if (index != System.Windows.Forms.ListBox.NoMatches)
            {
                ProgramContainer sltPro    = UtilMethods.stringToPC(startHubList.Items[index].ToString(), list);
                SelectPop        selectPop = new SelectPop(sltPro.name, sltPro.fileLoc, sltPro.imgLoc);
                selectPop.Show();
            }
        }
示例#4
0
        private void removeProgram_Click(object sender, EventArgs e)
        {
            ProgramContainer pro = UtilMethods.stringToPC((string)startHubList.SelectedItem, list);

            if (pro == null)
            {
                return;
            }

            startHubList.Items.Remove(startHubList.SelectedItem);
            UtilMethods.removeLine(pro.name, pro.fileLoc, pro.imgLoc);
        }
示例#5
0
        /// <summary>
        /// Reads all installed applications with registry entry under Windows and saves them in a
        /// </summary>
        /// <returns></returns>
        public ProgramContainer GetAllInstalledApplications()
        {
            var    listOfAllApplications = new ProgramContainer();
            string registryKey           = Properties.Resources.RegistryKeyPath;

            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(registryKey))
            {
                //Add operating system to the list
                //TODO: fill empty parameters and extract to own method
                listOfAllApplications.ProgramInformation.Add(new InstalledProgramInformation(new Guid(),
                                                                                             GetFriendlyOperatingSystemName(),
                                                                                             string.Empty, string.Empty, "Microsoft", string.Empty, "OperatingSystem"));

                if (key != null)
                {
                    foreach (string subkeyName in key.GetSubKeyNames())
                    {
                        using (RegistryKey subkey = key.OpenSubKey(subkeyName))
                        {
                            if (subkey != null)
                            {
                                PrintNameAndVersionToConsole(subkey);

                                var displayName = HKLM_GetString(subkey, "DisplayName");
                                if (displayName != null)
                                {
                                    var installedProgramInformation =
                                        new InstalledProgramInformation(new Guid(), displayName,
                                                                        HKLM_GetString(subkey, "DisplayVersion"),
                                                                        HKLM_GetString(subkey, "InstallDate"),
                                                                        HKLM_GetString(subkey, "Publisher"),
                                                                        HKLM_GetString(subkey, "DisplayIcon"), string.Empty);
                                    listOfAllApplications.ProgramInformation.Add(installedProgramInformation);
                                }
                            }
                        }
                    }
                }
            }
            return(listOfAllApplications);
        }
示例#6
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     this.DialogResult        = DialogResult.OK;
     ProgramContainerToCreate = new ProgramContainer(PathTextBox.Text, int.Parse(FrequencyTextBox.Text));
     Close();
 }