Exemplo n.º 1
0
        private void ListBoxTemplatesDoubleClick(object sender, EventArgs e)
        {
            SampleProjectInfo sample = listBoxTemplates.SelectedItem as SampleProjectInfo;

            OpenSampleProject(sample);
            Close();
        }
Exemplo n.º 2
0
        private void btnUninstall_Click(object sender, EventArgs e)
        {
            SampleProjectInfo sample = this.listBoxTemplates.SelectedItem as SampleProjectInfo;

            this.UninstallSampleProject(sample);
            this.UpdateInstalledProjectsList();
        }
Exemplo n.º 3
0
        private void BtnUninstallClick(object sender, EventArgs e)
        {
            SampleProjectInfo sample = listBoxTemplates.SelectedItem as SampleProjectInfo;

            UninstallSampleProject(sample);
            UpdateInstalledProjectsList();
        }
Exemplo n.º 4
0
        private void ListBoxTemplates_DoubleClick(object sender, EventArgs e)
        {
            SampleProjectInfo sample = this.listBoxTemplates.SelectedItem as SampleProjectInfo;

            this.OpenSampleProject(sample);
            base.Close();
        }
Exemplo n.º 5
0
        private void UninstallSampleProject(SampleProjectInfo sample)
        {
            if (this.App.SerializationManager.CurrentProjectFile == sample.AbsolutePathToProjectFile)
            {
                MessageBox.Show("Cannot uninstall " + sample.Name + ". The project is currently open. Please close current project and try again.");
                return;
            }
            string        directoryName = Path.GetDirectoryName(sample.AbsolutePathToProjectFile);
            DirectoryInfo parent        = Directory.GetParent(directoryName);

            try
            {
                foreach (string current in Directory.EnumerateFiles(directoryName))
                {
                    File.Delete(current);
                }
                Directory.Delete(directoryName);
                FileInfo[] files = parent.GetFiles();
                for (int i = 0; i < files.Length; i++)
                {
                    FileInfo fileInfo = files[i];
                    fileInfo.Delete();
                }
                if (!EnumerableExtensions.Any <DirectoryInfo>(parent.GetDirectories()) && !EnumerableExtensions.Any <FileInfo>(parent.GetFiles()))
                {
                    parent.Delete();
                }
            }
            catch (IOException ex)
            {
                MessageBox.Show("Some files could not be uninstalled. " + ex.Message);
            }
            MessageBox.Show("The project was successfully uninstalled.");
        }
Exemplo n.º 6
0
        private void OpenSampleProject(SampleProjectInfo sample)
        {
            string absolutePathToProjectFile = sample.AbsolutePathToProjectFile;

            try
            {
                App.SerializationManager.OpenProject(absolutePathToProjectFile);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format(Resources.ErrorFilePath, ex.Message, absolutePathToProjectFile));
            }
        }
Exemplo n.º 7
0
        private void OpenSampleProject(SampleProjectInfo sample)
        {
            string absolutePathToProjectFile = sample.AbsolutePathToProjectFile;

            try
            {
                this.App.SerializationManager.OpenProject(absolutePathToProjectFile);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " File: " + absolutePathToProjectFile);
            }
        }
Exemplo n.º 8
0
        private void UninstallSampleProject(SampleProjectInfo sample)
        {
            if (App.SerializationManager.CurrentProjectFile == sample.AbsolutePathToProjectFile)
            {
                MessageBox.Show(string.Format(Resources.CannotUninstallProjectOpen, sample.Name));
                return;
            }

            string directoryName = Path.GetDirectoryName(sample.AbsolutePathToProjectFile);

            if (directoryName != null)
            {
                DirectoryInfo parent = Directory.GetParent(directoryName);
                try
                {
                    foreach (string current in Directory.EnumerateFiles(directoryName))
                    {
                        File.Delete(current);
                    }

                    Directory.Delete(directoryName);
                    FileInfo[] files = parent.GetFiles();
                    for (int i = 0; i < files.Length; i++)
                    {
                        FileInfo fileInfo = files[i];
                        fileInfo.Delete();
                    }

                    if (!EnumerableExtensions.Any(parent.GetDirectories()) && !EnumerableExtensions.Any(parent.GetFiles()))
                    {
                        parent.Delete();
                    }
                }
                catch (IOException ex)
                {
                    MessageBox.Show(string.Format(Resources.SomeFilesCouldNotBeUninstalled, ex.Message));
                }
            }

            MessageBox.Show(Resources.ProjectSuccessfullyUninstalled);
        }
Exemplo n.º 9
0
 private void UninstallSampleProject(SampleProjectInfo sample) {
     if (this.App.SerializationManager.CurrentProjectFile == sample.AbsolutePathToProjectFile)
     {
         MessageBox.Show("Cannot uninstall " + sample.Name + ". The project is currently open. Please close current project and try again.");
         return;
     }
     string directoryName = Path.GetDirectoryName(sample.AbsolutePathToProjectFile);
     DirectoryInfo parent = Directory.GetParent(directoryName);
     try
     {
         foreach (string current in Directory.EnumerateFiles(directoryName))
         {
             File.Delete(current);
         }
         Directory.Delete(directoryName);
         FileInfo[] files = parent.GetFiles();
         for (int i = 0; i < files.Length; i++)
         {
             FileInfo fileInfo = files[i];
             fileInfo.Delete();
         }
         if (!NuGet.EnumerableExtensions.Any<DirectoryInfo>(parent.GetDirectories()) && !NuGet.EnumerableExtensions.Any<FileInfo>(parent.GetFiles()))
         {
             parent.Delete();
         }
     }
     catch (IOException ex)
     {
         MessageBox.Show("Some files could not be uninstalled. " + ex.Message);
     }
     MessageBox.Show("The project was successfully uninstalled.");
 }
Exemplo n.º 10
0
 private void OpenSampleProject(SampleProjectInfo sample) {
     string absolutePathToProjectFile = sample.AbsolutePathToProjectFile;
     try
     {
         this.App.SerializationManager.OpenProject(absolutePathToProjectFile);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + " File: " + absolutePathToProjectFile);
     }
 }