Ejemplo n.º 1
0
 /// <summary>
 /// Handles the Click event of the ButtonNewExtension control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
 /// <remarks>Documented by Dev02, 2009-07-09</remarks>
 private void ButtonNewExtension_Click(object sender, RoutedEventArgs e)
 {
     Clear();
     System.Windows.Forms.SaveFileDialog DialogSave = new System.Windows.Forms.SaveFileDialog();
     DialogSave.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
     DialogSave.Filter = MLifter.SettingsManager.Properties.Resources.EXTENSION_FILEFILTER;
     DialogSave.FilterIndex = 1;
     DialogSave.RestoreDirectory = true;
     if (DialogSave.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         string file = DialogSave.FileName;
         ExtensionFile extensionFile = new ExtensionFile(file);
         extensionFile.Create();
         OpenExtensionFile(file);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Opens the extension file.
 /// </summary>
 /// <param name="filename">The filename.</param>
 /// <remarks>Documented by Dev02, 2009-07-09</remarks>
 private void OpenExtensionFile(string filename)
 {
     ExtensionFile extFile = new ExtensionFile(filename);
     extFile.Open(LoginForm.OpenLoginForm);
     if (extFile.Extension.Version.Major < 1)
         extFile.Extension.Version = new Version(1, 0, 0);
     ExtensionFile = extFile;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Click event of the buttonAddExtension control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev08, 2009-07-10</remarks>
        private void buttonAddExtension_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = MLifter.SettingsManager.Properties.Resources.EXTENSION_FILEFILTER;
            if (ofd.ShowDialog().Value)
            {
                ExtensionFile extFile = new ExtensionFile(ofd.FileName);
                extFile.Open(LoginForm.OpenLoginForm);
                Guid extensionId = extFile.Extension.Id;

                if (SettingsManagerLogic.LearningModule.Extensions.Any(ext => ext.Id == extensionId) &&
                    MessageBox.Show(String.Format(MLifter.SettingsManager.Properties.Resources.EXTENSION_REPLACE_TEXT, extFile.Extension.Name),
                    MLifter.SettingsManager.Properties.Resources.EXTENSION_REPLACE_CAPTION, MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
                    return;

                IExtension newExt = SettingsManagerLogic.LearningModule.ExtensionFactory(extFile.Extension.Id);
                extFile.Extension.CopyTo(newExt, null);

                LoadLMExtensions();
            }
        }