示例#1
0
        private void CreateProfil()
        {
            var newProfil           = new ProfilViewModel();
            AddProfileDialog dialog = new AddProfileDialog
            {
                DataContext = newProfil,
                Owner       = Application.Current.MainWindow
            };
            var resDialog = dialog.ShowDialog();

            if (resDialog.HasValue && resDialog.Value)
            {
                newProfil.Command = new RelayCommand(o => SelectProfil((ProfilViewModel)o));
                Profils.Add(newProfil);
                SelectProfil(newProfil);
            }
        }
示例#2
0
 private void propertiesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Profiles.SelectedItems[0].Group == Profiles.Groups[0]) {
         AddProfileDialog diag = new AddProfileDialog(true);
         diag.ShowDialog();
     }
     else {
         AddProfileDialog diag = new AddProfileDialog(new StarterProfile(Profiles.SelectedItems[0].Text));
         diag.ShowDialog();
         ReloadProfiles();
     }
 }
示例#3
0
 private void duplicateMenuItem_Click(object sender, EventArgs e)
 {
     if (Profiles.SelectedItems.Count == 1) {
         StarterProfile oldProfile;
         String oldFolder;
         String newProfileAddOn = "";
         if (Profiles.SelectedItems[0] == DefaultProfileItem) {
             oldProfile = null;
             var directory = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Electronic Arts"));
             var root = FindSimsRoot(directory, 6);
             oldFolder = root.FullName;
             newProfileAddOn = Path.Combine(root.Parent.Parent.Name, Path.Combine(root.Parent.Name, root.Name));
         }
         else {
             oldProfile = new StarterProfile(Profiles.SelectedItems[0].Text);
             oldFolder = oldProfile.VirtualAppDataFolder;
         }
         var diag = new AddProfileDialog(oldProfile, true);
         diag.ShowDialog();
         var newProfile = diag.Profile;
         if (newProfile == null) return;
         var newFolder = newProfile.VirtualAppDataFolder;
         if (newProfileAddOn != null) {
             newFolder = Path.Combine(newFolder, newProfileAddOn);
             new DirectoryInfo(newFolder).Create();
         }
         try {
             new Computer().FileSystem.CopyDirectory(oldFolder, newFolder, Microsoft.VisualBasic.FileIO.UIOption.AllDialogs, Microsoft.VisualBasic.FileIO.UICancelOption.ThrowException);
         }
         catch (Exception ex) {
             MessageBox.Show(ex.Message);
             newProfile.Delete();
         }
         ReloadProfiles();
     }
 }
示例#4
0
 private void addProfile_Click(object sender, EventArgs e)
 {
     AddProfileDialog diag = new AddProfileDialog();
     diag.ShowDialog();
     ReloadProfiles();
 }