Esempio n. 1
0
        private void ToolStripMenuItemClone_Click(object sender, EventArgs e)
        {
            Profile profile = Profiles.Find(x => x.Id == (int)listViewProfile.SelectedItems[0].Tag);

            Profile clonedProfile = profile.Clone();

            clonedProfile.Name = GenerateEnumeratedName(clonedProfile.Name);
            List <Options> clonedOptions = new List <Options>();

            foreach (Options option in DBAccess.ListProfileOptions(profile))
            {
                Options clonedOption = option.Clone();
                clonedOption.Profile = clonedProfile;
                clonedOptions.Add(clonedOption);
            }

            clonedProfile.ListViewIndex = listViewProfile.Items.Count;
            DBAccess.AddProfile(clonedProfile);
            Profiles.Add(clonedProfile);

            foreach (Options clonedOption in clonedOptions)
            {
                DBAccess.AddOption(clonedOption);
            }

            ListViewItem item = new ListViewItem();

            EditListViewItem(clonedProfile, item);
            listViewProfile.Items.Add(item);
            //ResizeForm();
        }
Esempio n. 2
0
        private void AddProfile()
        {
            Profile profile = new Profile
            {
                Name             = textBoxProfileName.Text,
                TimeCreated      = DateTime.Now, //yyyy-MM-dd HH:mm:ss,
                LastTimeModified = DateTime.MinValue,
                LastTimeExecuted = DateTime.MinValue
            };

            profile.ListViewIndex = ProfileMenu.listViewProfile.Items.Count;
            DBAccess.AddProfile(profile);
            ProfileMenu.Profiles.Add(profile);
            ListViewItem item = new ListViewItem();

            ProfileMenu.EditListViewItem(profile, item);
            ProfileMenu.listViewProfile.Items.Add(item);
            //ProfileMenu.ResizeForm();
        }