Exemplo n.º 1
0
        /// <summary>
        ///   Constructor for the module
        /// </summary>
        public ModuleEditor(IModule module)
        {
            try
            {
                this.InitializeComponent();
                this._module = module;
                this._module.Attach(this);
                this._documentHandler = new ModuleDocument(this._module, this, this.textEditor1, this.textEditor2);
                this.Prepare();

                this._editedCheckTimer = new DispatcherTimer
                {
                    Interval = TimeSpan.FromSeconds(3)
                };
                this._editedCheckTimer.Tick += this.IsEditedTick;
                this._editedCheckTimer.Start();

                this.ModuleViewBorderContainer.Child = new ModulePane(this._module, this._documentHandler);
                this.Tag = this._module.GetModuleName() + ".pm";

                Framework.ShutDown += this.Terminate;
            }
            catch (Exception error)
            {
                Framework.EventBus.Publish(error);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///   Dispose this object and all the observers
 /// </summary>
 /// <param name = "obj">IModuleObserver</param>
 public void Dispose(IModuleObserver obj)
 {
     try
     {
         this._documentHandler.Dispose(this);
         this._module.Detach(this);
         this._editedCheckTimer.Stop();
         this._module        = null;
         Framework.ShutDown -= this.Terminate;
         Framework.Panels.RemoveMainComponent(this);
     }
     catch (Exception error)
     {
         Framework.EventBus.Publish(error);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        ///   Asks the UserControl to do some clean up!
        /// </summary>
        public void Dispose()
        {
            try
            {
                this._documentHandler.Dispose(this);
                this._module.Detach(this);
                this._editedCheckTimer.Stop();
                this._module = null;

                var pane = ( ModulePane )this.ModuleViewBorderContainer.Child;
                pane.Dispose(this);
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///   Update this observer with a refernece to the module
        /// </summary>
        /// <param name = "module">IModule</param>
        /// <param name = "source">IModuleObserver</param>
        public void Update(IModule module, IModuleObserver source)
        {
            try
            {
                if (source == this)
                {
                    return;
                }

                this._module = module;
                this.moduleNameLabel.Content = this._module.GetModuleName();
                this.Tag = this._module.GetModuleName() + " Module";
            }
            catch (Exception error)
            {
                Framework.EventBus.Publish(error);
            }
        }