Exemplo n.º 1
0
        /// <summary>
        /// Attach the current project with module loading
        /// </summary>
        protected override void Load(IModuleManager moduleManager, ICommandLine commandLine)
        {
            base.Load(moduleManager, commandLine);

            try
            {
                if (form == null)
                {
                    form = new LocalizationManager();
                    container.Add(form);
                    form.Closed += new EventHandler(MainForm_Closed);
                    form.Disposed += new EventHandler(MainForm_Disposed);
                    form.Show();
                    form.Activate();

                    // assure handle creation
                    System.IntPtr handle = form.Handle;

                    // read the command line
                    if (commandLine != null)
                    {
                        string titleArgument = commandLine.GetArgument("title");
                        if (titleArgument != null)
                        {
                            form.Text = titleArgument;
                        }
                    }
                    base.OnLoaded();
                }
                else
                {
                    if (!form.IsDisposed)
                    {
                        form.Show();
                        if (form.WindowState == FormWindowState.Minimized)
                        {
                            form.WindowState = FormWindowState.Normal;
                        }
                        form.Activate();
                    }

                }
            }
            finally
            {
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Attach the current project with module loading
        /// </summary>
        public void Load(IModuleManager moduleManager, ICommandLine commandLine)
        {
            //base.Load(moduleManager, commandLine);
            this.moduleManager = moduleManager;
            try
            {
                if (form == null)
                {
                    form = new EnterMainForm(this);
                    container.Add(form);
                    form.Closed += new EventHandler(MainForm_Closed);
                    form.Disposed += new EventHandler(MainForm_Disposed);
                    form.Show();
                    form.Activate();

                    // assure handle creation
                    System.IntPtr handle = form.Handle;

                    // read the command line
                    if (commandLine != null)
                    {
                        string titleArgument = commandLine.GetArgument("title");
                        if (titleArgument != null)
                        {
                            form.Text = titleArgument;
                        }

                        if (commandLine.GetArgument("project") != null)
                        {
                            Project p = new Project(commandLine.GetArgument("project"));
                            form.FireOpenViewEvent(p.Views[commandLine.GetArgument("view")]);
                        }
                        else
                        {
                            if (!form.IsDisposed)
                            {
                                form.Show();
                                if (form.WindowState == FormWindowState.Minimized)
                                {
                                    form.WindowState = FormWindowState.Normal;
                                }
                                form.Activate();
                            }
                        }
                    }
                    //base.OnLoaded();
                }
                else
                {
                    if (!form.IsDisposed)
                    {
                        form.Show();
                        if (form.WindowState == FormWindowState.Minimized)
                        {
                            form.WindowState = FormWindowState.Normal;
                        }
                        form.Activate();
                    }

                }
            }
            finally
            {
            }

            //Processor.CommunicateUI += new CommunicateUIEventHandler(MsgResponse);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Attach the current project with module loading
        /// </summary>
        protected override void Load(IModuleManager moduleManager, ICommandLine commandLine)
        {
            base.Load(moduleManager, commandLine);

            try
            {
                if (form == null)
                {
                    form = new MakeViewMainForm(this);
                    container.Add(form);
                    form.Closed += new EventHandler(MainForm_Closed);
                    form.Disposed += new EventHandler(MainForm_Disposed);
                    form.Show();
                    form.Activate();

                    // assure handle creation
                    System.IntPtr handle = form.Handle;

                    // read the command line
                    if (commandLine != null)
                    {
                        string titleArgument = commandLine.GetArgument("title");
                        if (titleArgument != null)
                        {
                            form.Text = titleArgument;
                        }
                    }
                    base.OnLoaded();
                }
                else
                {
                    if (!form.IsDisposed)
                    {
                        form.Show();
                        if (form.WindowState == FormWindowState.Minimized)
                        {
                            form.WindowState = FormWindowState.Normal;
                        }
                        form.Activate();
                    }

                }
            }
            finally
            {
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Attach the current project with module loading
        /// </summary>
        protected override void Load(IModuleManager moduleManager, ICommandLine commandLine)
        {
            // create a new instance of the analysis engine module. Module will be isolated from Windows
            // ApplicationManager GetService chain.
            // engine = new AnalysisEngine(moduleManager, null);

            base.Load(moduleManager, commandLine);

            try
            {
                 //Attach CurrentProject
                Configuration config = Configuration.GetNewInstance();
                string filePath = config.CurrentProjectFilePath;
                if (!string.IsNullOrEmpty(filePath))
                {

                    // Try to open the current project in the configuration file.
                    // If the project can't be opened, recover from the error and update the configuration file.
                    try
                    {
                        CurrentProject = new Project(filePath);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.ShowException(ex);
                        config.CurrentProjectFilePath = string.Empty;
                        Configuration.Save(config);
                    }
                }

                if (form == null)
                {
                    base.OnLoaded();
                    form = new Forms.AnalysisMainForm(this);
                    container.Add(form);
                    form.Closed += new EventHandler(MainForm_Closed);
                    form.Disposed += new EventHandler(MainForm_Disposed);
                    form.Show();
                    if (!Util.IsEmpty(form))
                    {
                        form.Activate();

                        // assure handle creation
                        System.IntPtr handle = form.Handle;

                        // read the command line
                        if (commandLine != null)
                        {
                            string titleArgument = commandLine.GetArgument("title");
                            if (titleArgument != null)
                            {
                                form.Text = titleArgument;
                            }
                        }
                    }
                }
                else
                {
                    if (!form.IsDisposed)
                    {
                        form.Show();
                        if (form.WindowState == FormWindowState.Minimized)
                        {
                            form.WindowState = FormWindowState.Normal;
                        }
                        form.Activate();
                    }
                }
                //zack 1/2/08
                //Processor.CommunicateUI += new CommunicateUIEventHandler(MsgResponse);

                // KKM4 Commented this out since HandleDialogEvent is never raised.
                // Processor.HandleDialogEvent += new DialogBoxUIEventHandler(DialogResponse); //dcs0 4/23/08

            }
            catch (Exception ex)
            {
                throw new GeneralException(SharedStrings.MODULE_NOT_LOADED + ": \n" + ex.Message, ex);
            }
            finally
            {
                if (Util.IsEmpty(form))
                {
                    this.Dispose();
                    Application.ExitThread();
                }
            }
        }
Exemplo n.º 5
0
        /*
         * private bool MsgResponse(EpiMessages msg, MessageType msgtype)
         * {
         *  MessageBoxButtons buttons;
         *  switch (msgtype)
         *  {
         *      case MessageType.OkOnly:
         *          buttons = MessageBoxButtons.OK;
         *          MessageBox.Show(msg.Message, msg.Caption, buttons);
         *          return true;
         *      case MessageType.YesNo:
         *          buttons = MessageBoxButtons.YesNo;
         *          DialogResult result;
         *          result = MessageBox.Show(msg.Message, msg.Caption, buttons);
         *          if (result == DialogResult.Yes)
         *          {
         *              return true;
         *          }
         *          else
         *          {
         *              return false;
         *          }
         *      default:
         *          return false;
         *  }
         * }*/

        #endregion  //Private Methods

        #region Protected Methods

        /// <summary>
        /// Attach the current project with module loading
        /// </summary>
        public void Load(IModuleManager moduleManager, ICommandLine commandLine)
        {
            //base.Load(moduleManager, commandLine);
            this.moduleManager = moduleManager;
            try
            {
                if (form == null)
                {
                    form = new EnterMainForm(this);
                    container.Add(form);
                    form.Closed   += new EventHandler(MainForm_Closed);
                    form.Disposed += new EventHandler(MainForm_Disposed);
                    form.Show();
                    form.Activate();

                    // assure handle creation
                    System.IntPtr handle = form.Handle;

                    // read the command line
                    if (commandLine != null)
                    {
                        string titleArgument = commandLine.GetArgument("title");
                        if (titleArgument != null)
                        {
                            form.Text = titleArgument;
                        }

                        if (commandLine.GetArgument("project") != null)
                        {
                            Project p = new Project(commandLine.GetArgument("project"));
                            form.FireOpenViewEvent(p.Views[commandLine.GetArgument("view")]);
                        }
                        else
                        {
                            if (!form.IsDisposed)
                            {
                                form.Show();
                                if (form.WindowState == FormWindowState.Minimized)
                                {
                                    form.WindowState = FormWindowState.Normal;
                                }
                                form.Activate();
                            }
                        }
                    }
                    //base.OnLoaded();
                }
                else
                {
                    if (!form.IsDisposed)
                    {
                        form.Show();
                        if (form.WindowState == FormWindowState.Minimized)
                        {
                            form.WindowState = FormWindowState.Normal;
                        }
                        form.Activate();
                    }
                }
            }
            finally
            {
            }

            //Processor.CommunicateUI += new CommunicateUIEventHandler(MsgResponse);
        }
        /// <summary>
        /// Attach the current project with module loading
        /// </summary>
        protected override void Load(IModuleManager moduleManager, ICommandLine commandLine)
        {

            // create a new instance of the analysis engine module. Module will be isolated from Windows
            // ApplicationManager GetService chain.
            // engine = new AnalysisEngine(moduleManager, null);
            
            base.Load(moduleManager, commandLine);

            try
            {
                 //Attach CurrentProject
                Configuration config = Configuration.GetNewInstance();
                string filePath = config.CurrentProjectFilePath;
                if (!string.IsNullOrEmpty(filePath))
                {

                    // Try to open the current project in the configuration file.
                    // If the project can't be opened, recover from the error and update the configuration file.
                    try
                    {
                        CurrentProject = new Project(filePath);
                    }
                    catch (Exception ex)
                    {
                        MsgBox.ShowException(ex);
                        config.CurrentProjectFilePath = string.Empty;
                        Configuration.Save(config);
                    }
                }

                if (form == null)
                {
                    base.OnLoaded();
                    form = new Forms.AnalysisMainForm(this);
                    container.Add(form);
                    form.Closed += new EventHandler(MainForm_Closed);
                    form.Disposed += new EventHandler(MainForm_Disposed);
                    form.Show();
                    if (!Util.IsEmpty(form))
                    {
                        form.Activate();

                        // assure handle creation
                        System.IntPtr handle = form.Handle;

                        // read the command line
                        if (commandLine != null)
                        {
                            string titleArgument = commandLine.GetArgument("title");
                            if (titleArgument != null)
                            {
                                form.Text = titleArgument;
                            }
                        }
                    }
                }
                else
                {
                    if (!form.IsDisposed)
                    {
                        form.Show();
                        if (form.WindowState == FormWindowState.Minimized)
                        {
                            form.WindowState = FormWindowState.Normal;
                        }
                        form.Activate();
                    }
                }
                //zack 1/2/08
                //Processor.CommunicateUI += new CommunicateUIEventHandler(MsgResponse);

                // KKM4 Commented this out since HandleDialogEvent is never raised.
                // Processor.HandleDialogEvent += new DialogBoxUIEventHandler(DialogResponse); //dcs0 4/23/08
               
            }
            catch (Exception ex)
            {
                throw new GeneralException(SharedStrings.MODULE_NOT_LOADED + ": \n" + ex.Message, ex);
            }
            finally
            {
                if (Util.IsEmpty(form))
                {
                    this.Dispose();
                    Application.ExitThread();  
                }
            }
        }