예제 #1
0
        protected virtual void OnLearningModuleSelected(LearningModuleSelectedEventArgs e)
        {
            selectedLearningModule = e.LearnModule;

            if (LearningModuleSelected != null)
                LearningModuleSelected(this, e);
        }
예제 #2
0
        /// <summary>
        /// Handles the OnImportLearningModule event of the learningModulesTreeViewControl control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MLifter.Controls.ImportLearningModuleEventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev03, 2009-03-11</remarks>
        private void learningModulesTreeViewControl_OnImportLearningModule(object sender, ImportLearningModuleEventArgs e)
        {
            IConnectionString target = e.TreeNode.Connection;

            if (target.ConnectionType == DatabaseType.Web)
            {
                TaskDialog.MessageBox(Resources.STARTUP_IMPORT_LEARNING_MODULE_PERMISSION_MBX_CAPTION, Resources.STARTUP_IMPORT_LEARNING_MODULE_PERMISSION_MBX_TEXT, string.Empty, TaskDialogButtons.OK, TaskDialogIcons.Error);
                return;
            }

            if (e.LearningModule.ConnectionString.Typ == DatabaseType.Xml || DAL.Helper.IsOdfFormat(e.LearningModule.ConnectionString.ConnectionString))
            {
                // open/convert instead of import
                if (target.ConnectionType == DatabaseType.Unc)
                {
                    LearningModuleSelectedEventArgs args = new LearningModuleSelectedEventArgs(e.LearningModule);

                    if (LearningModuleSelected != null)
                        LearningModuleSelected(this, args);
                }
                else
                {
                    DialogResult resultConvert = MLifter.Controls.TaskDialog.ShowTaskDialogBox(Resources.LEARNING_MODULES_PAGE_CONVERT_TITLE,
                        Resources.LEARNING_MODULES_PAGE_CONVERT_MAIN, Resources.LEARNING_MODULES_PAGE_CONVERT_CONTENT,
                        String.Empty, String.Empty, String.Empty, String.Empty,
                        String.Format("{0}|{1}", Resources.LEARNING_MODULES_PAGE_CONVERT_OPTION_YES, Resources.LEARNING_MODULES_PAGE_CONVERT_OPTION_NO),
                        MLifter.Controls.TaskDialogButtons.None, MLifter.Controls.TaskDialogIcons.Question, MLifter.Controls.TaskDialogIcons.Warning);
                    switch (MLifter.Controls.TaskDialog.CommandButtonResult)
                    {
                        case 0:
                            LearningModuleSelectedEventArgs args = new LearningModuleSelectedEventArgs(e.LearningModule);

                            if (LearningModuleSelected != null)
                                LearningModuleSelected(this, args);
                            break;
                        case 1:
                        default:
                            break;
                    }
                }
            }
            else
            {
                DialogResult result = MLifter.Controls.TaskDialog.ShowTaskDialogBox(Resources.STARTUP_IMPORT_LEARNING_MODULE_MBX_CAPTION,
                    Resources.STARTUP_IMPORT_LEARNING_MODULE_MBX_TEXT, String.Format(Resources.STARTUP_IMPORT_LEARNING_MODULE_CONTENT, target.Name),
                    String.Empty, String.Empty, String.Empty, String.Empty,
                    String.Format("{0}|{1}", Resources.STARTUP_IMPORT_LEARNING_MODULE_MBX_OPTION_YES, Resources.STARTUP_IMPORT_LEARNING_MODULE_MBX_OPTION_NO),
                    MLifter.Controls.TaskDialogButtons.None, MLifter.Controls.TaskDialogIcons.Question, MLifter.Controls.TaskDialogIcons.Warning);
                switch (MLifter.Controls.TaskDialog.CommandButtonResult)
                {
                    case 0:
                        LearningModulesIndexEntry source = null;
                        try
                        {
                            FolderIndexEntry folder = lmIndex.GetFolderOfConnection(target);
                            learningModulesTreeViewControl.SetSelectedFolder(folder);
                            conTarget = target;
                            source = lmIndex.CreateLearningModuleIndexEntry(e.LearningModule.ConnectionString.ConnectionString);
                        }
                        catch (ServerOfflineException)
                        {
                            ShowServerOfflineMessage(new List<IConnectionString>() { target }, false);
                        }
                        catch (NoValidUserException)
                        {
                            // user pressed cancel on login dialog
                        }
                        catch
                        {
                            MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_LOCKED_TEXT, e.LearningModule.ConnectionString.ConnectionString),
                                Properties.Resources.DIC_ERROR_LOADING_LOCKED_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        if (source == null)
                            return;
                        ImportLearningModule(source);
                        break;
                    case 1:
                    default:
                        selectedLearningModule = e.LearningModule;
                        if (LearningModuleSelected != null)
                            LearningModuleSelected(this, new LearningModuleSelectedEventArgs(e.LearningModule));
                        break;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Handles the OnOpenLearningModule event of the learningModulesTreeViewControl control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="MLifter.Controls.LearningModuleSelectedEventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev03, 2009-03-11</remarks>
        private void learningModulesTreeViewControl_OnOpenLearningModule(object sender, LearningModuleSelectedEventArgs e)
        {
            selectedLearningModule = e.LearnModule;

            if (LearningModuleSelected != null)
                LearningModuleSelected(this, e);
        }
예제 #4
0
        /// <summary>
        /// Handles the Tick event of the FileDropTimer control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev08, 2009-02-27</remarks>
        private void FileDropTimer_Tick(object sender, EventArgs e)
        {
            System.Windows.Forms.Timer timer = sender as System.Windows.Forms.Timer;
            timer.Stop();
            if (timer.Tag != null && timer.Tag is string)
            {
                string file = (string)timer.Tag;
                if (Helper.CheckFileName(file))
                {
                    if (Helper.IsLearningModuleFileName(file))
                    {
                        LearningModuleSelectedEventArgs args = new LearningModuleSelectedEventArgs(
                            new LearningModulesIndexEntry(
                                new ConnectionStringStruct(
                                    (Path.GetExtension(file) == DAL.Helper.OdxExtension ||
                                        Path.GetExtension(file) == DAL.Helper.DzpExtension ||
                                        Path.GetExtension(file) == DAL.Helper.OdfExtension) ? DatabaseType.Xml : DatabaseType.MsSqlCe, file, false)
                                ) { ConnectionName = Path.GetDirectoryName(file) }
                            );
                        selectedLearningModule = args.LearnModule;
                        args.IsUsedDragAndDrop = true;      //[ML-2023] Inconsistent Drag and Drop behaviour

                        if (LearningModuleSelected != null)
                            LearningModuleSelected(this, args);
                    }
                    else
                    {
                        if (ImportConfigFile(file))
                            LoadLearningModules();
                    }
                }
            }
            timer.Dispose();
        }