Ejemplo n.º 1
0
        /// <summary>
        /// Hanled the message when object was changed.
        /// then send this message to its related modules.
        /// </summary>
        /// <param name="message"></param>
        public void Handle(NotifyRelatedMessage message)
        {
            IList <string> relatedEntityNames = this.GetRelatedEntityNames(message.ObjectName, message.ObjectName);

            foreach (string entityName in relatedEntityNames)
            {
                EventAggregationManager.SendMessage(new ObjectSetChangedMessage {
                    ObjectName = entityName
                });
                EventAggregationManager.SendMessage(new UpdateDetailEntityMessage {
                    ObjectName = entityName
                });
            }

            //addCustomRelation.
            IList <string> customrelatedEntityNames = this.GetCustomRelatedEntityNames(message.ObjectName);

            foreach (string entityName in customrelatedEntityNames)
            {
                EventAggregationManager.SendMessage(new ObjectSetChangedMessage {
                    ObjectName = entityName
                });
                EventAggregationManager.SendMessage(new UpdateDetailEntityMessage {
                    ObjectName = entityName
                });
            }
        }
 protected override void OnSaved()
 {
     EventAggregationManager.SendMessage(new ObjectSetChangedMessage {
         ObjectName = "ProjectTask"
     });
     base.OnSaved();
 }
        public bool SetOpportunityFail(Opportunity opportunity)
        {
            OpportunityLossReason resonForm = new OpportunityLossReason();
            DialogResult          result    = resonForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                string lossReason = resonForm.LossReasion;
                opportunity.ClosedTime     = DateTime.Now;
                opportunity.StatusCode     = (int)OpportunityStatus.Lost;
                opportunity.SalesStageCode = opportunity.StatusCode + SaleStageCodeOffSet;
                if (!string.IsNullOrEmpty(lossReason))
                {
                    opportunity.Description += "\r\n" + lossReason;
                }
                this._objectSpace.SaveChanges();

                ObjectSetChangedMessage msg = new ObjectSetChangedMessage();
                msg.ObjectName = this.ObjectName;
                EventAggregationManager.SendMessage(msg);

                UpdateRibbonItemMessage msgRefreshCmd = new UpdateRibbonItemMessage(this.WorkSpaceID, this.ObjectName);

                EventAggregationManager.SendMessage(msgRefreshCmd);
            }
            return(true);
        }
Ejemplo n.º 4
0
        public override void Run()
        {
            if (!(this.Owner is IObjectDetailController))
            {
                return;
            }
            IObjectDetailController detailPresenter = (IObjectDetailController)this.Owner;

            if (!detailPresenter.SaveAndClose())
            {
                return;
            }


            //notify listview focus added row
            ObjectAddedMessage msg = new ObjectAddedMessage();

            msg.ObjectID   = detailPresenter.ObjectId;
            msg.ObjectName = detailPresenter.ObjectName;
            EventAggregationManager.SendMessage <ObjectAddedMessage>(msg);

            //notify related Module to Refresh.
            NotifyRelatedMessage relatedMsg = new NotifyRelatedMessage();

            relatedMsg.ObjectName = detailPresenter.ObjectName;
            EventAggregationManager.SendMessage <NotifyRelatedMessage>(relatedMsg);
        }
Ejemplo n.º 5
0
 protected override void OnSaved()
 {
     EventAggregationManager.SendMessage(new ObjectSetChangedMessage {
         ObjectName = ObjectName
     });
     _noteView.CloseView();
 }
Ejemplo n.º 6
0
 public MainForm()
 {
     InitializeComponent();
     ribbonControl1.MdiMergeStyle = RibbonMdiMergeStyle.Always;
     this.Bounds = Screen.PrimaryScreen.WorkingArea;
     EventAggregationManager.AddListener(this);
 }
Ejemplo n.º 7
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         EventAggregationManager.RemoveListener(this);
     }
 }
Ejemplo n.º 8
0
 protected void View_ObjectChanged(object sender, EventArgs e)
 {
     if (!HasChanges)
     {
         HasChanges = true;
         var message = new UpdateRibbonItemMessage(this.WorkSpaceID, this.ObjectName);
         EventAggregationManager.SendMessage(message);
     }
 }
Ejemplo n.º 9
0
        public RibbonFormWorkspace(ActionParameters parameters)
        {
            InitializeComponent();
            EventAggregationManager.AddListener(this);
            _wokspaceID = Guid.NewGuid();

            _config           = new ConfigService.ConfigService();
            _workspaceContext = new WorkSpaceContext(this, this, this, parameters, this);
        }
Ejemplo n.º 10
0
        protected void SendMessage(string itemName)
        {
            Guard.ArgumentNotNull(Object, "Owner");
            IController controller = this.Owner as IController;
            // var message = new UpdateRibbonItemMessage { ItemName = itemName, ObjectName = Object.ObjectName };
            var message = new UpdateRibbonItemMessage(controller.Context.WorkSpace.ID, Object.ObjectName, itemName);

            EventAggregationManager.SendMessage(message);
        }
Ejemplo n.º 11
0
        void _tabbedView_DocumentClosing(object sender, DocumentCancelEventArgs e)
        {
            WorkSpaceClosed workSpaceMsg = new WorkSpaceClosed();
            IWorkspace1     workspace    = e.Document.Control as IWorkspace1;

            workSpaceMsg.ModuleName    = workspace.ObjectName;
            workSpaceMsg.WorkSpaceName = workspace.ObjectName;

            EventAggregationManager.SendMessage(workSpaceMsg);
        }
        public override void Run()
        {
            Guard.ObjectIsInstanceOfType(Owner, typeof(IObjectDetailController), "Owner");
            var         detailController = (IObjectDetailController)this.Owner;
            IController controller       = this.Owner as IController;
            var         message          = new ActivateViewMessage(controller.WorkSpaceID, "NoteList");

            message.Parameters = new ActionParameters(detailController.ObjectName, detailController.ObjectId, ViewShowType.Show);
            EventAggregationManager.SendMessage(message);
        }
Ejemplo n.º 13
0
 public virtual void UpdateContextFilters()
 {
     UpdateContextFilters(_projectTaskFilterView.Context, _projectTaskFilterView.ProjectId, _projectTaskFilterView.ProjectIterationId, _projectTaskFilterView.MemberId);
     if (_sendMessaage)
     {
         EventAggregationManager.SendMessage(new UpdateContextFilterMessage {
             FixedFilter = _projectTaskFilterView.Context.GetFilters()
         });
     }
 }
Ejemplo n.º 14
0
        void SendFilterMessage(object sender, AppFramework.Utils.EventArgs <string> e)
        {
            CriteriaOperator filter = CriteriaOperator.TryParse(e.Data);

            EventAggregationManager.SendMessage(new FilterChangedMessage
            {
                ObjectName = ObjectName,
                Filter     = filter
            });
        }
Ejemplo n.º 15
0
        public override void Run()
        {
            IController controller = this.Owner as IController;

            if (controller != null)
            {
                ActivateViewMessage message = new ActivateViewMessage(controller.WorkSpaceID, "DefaultDetailView");

                EventAggregationManager.SendMessage(message);
            }
        }
Ejemplo n.º 16
0
        public override void Run()
        {
            Guard.ObjectIsInstanceOfType(Owner, typeof(IObjectAware), "Owner");
            Guard.ObjectIsInstanceOfType(Owner, typeof(IController), "Owner");
            var objectAware = (IObjectAware)this.Owner;
            var controller  = (IController)this.Owner;
            var message     = new ObjectSetChangedMessage {
                ObjectName = objectAware.ObjectName, WorkSpaceID = controller.WorkSpaceID
            };

            EventAggregationManager.SendMessage(message);
        }
Ejemplo n.º 17
0
        protected override void OnClosing(CancelEventArgs e)
        {
            this.SaveLayout();
            var message = new ViewManageMessage
            {
                ViewName   = this.Name,
                ViewAction = ViewAction.Remove
            };

            EventAggregationManager.SendMessage(message);
            base.OnClosing(e);
        }
Ejemplo n.º 18
0
        private void RibbonFormWorkspace_FormClosed(object sender, FormClosedEventArgs e)
        {
            EventAggregationManager.RemoveListener(this);

            EventAggregationManager.RemoveListener(this._mainController);

            foreach (var controller in this._controllers)
            {
                EventAggregationManager.RemoveListener(controller.Value);
                controller.Value.Dispose();
            }
        }
        protected override void OnViewSet()
        {
            if (!(_detailView is INewTaskEffortDetailView))
            {
                return;
            }
            _newEffortView = (INewTaskEffortDetailView)_detailView;
            BindData();
            _newEffortView.ObjectChanged += View_ObjectChanged;
            HasChanges = false;
            var message = new UpdateRibbonItemMessage(this.WorkSpaceID, this.ObjectName);

            EventAggregationManager.SendMessage(message);
        }
Ejemplo n.º 20
0
        public override void Run()
        {
            Guard.ObjectIsInstanceOfType(Owner, typeof(ListController), "Owner");
            var  controller = (ListController)this.Owner;
            bool result     = controller.Delete();

            if (result)
            {
                NotifyRelatedMessage relatedMsg = new NotifyRelatedMessage();
                relatedMsg.ObjectName = controller.ObjectName;

                EventAggregationManager.SendMessage <NotifyRelatedMessage>(relatedMsg);
            }
        }
Ejemplo n.º 21
0
        protected override void Dispose(bool disposing)
        {
            this.UnRegisterEventHandlers();
            ODataListSource source = this.bindingSource1.DataSource as ODataListSource;

            if (source != null)
            {
                source.Clear();
                source.Dispose();
                source = null;
            }
            if (this._comingDataSource != null)
            {
                this._comingDataSource.Clear();
                this._comingDataSource.Dispose();
                this._comingDataSource = null;
            }

            this.bindingSource1.DataSource = null;
            if (source != null)
            {
                source.Clear();
                source.Dispose();
            }

            if (disposing)
            {
                EventAggregationManager.RemoveListener(this);
                if (components != null)
                {
                    components.Dispose();
                }
            }
            if (this.gridControl1 != null)
            {
                this.gridControl1.DataSource = null;
                this.gridView1 = null;
                this.gridControl1.Dispose();
            }
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            if (this.DoubleClickCommand != null)
            {
                this.DoubleClickCommand = null;
            }
            base.Dispose(disposing);
            GC.Collect();
        }
Ejemplo n.º 22
0
 public override void Run()
 {
     if (this.Owner is IController)
     {
         IController controller = this.Owner as IController;
         Guard.ObjectIsInstanceOfType(Owner, typeof(IObjectAware), "Owner");
         var objectAware = (IObjectAware)this.Owner;
         EventAggregationManager.SendMessage(new ToggleVisibilityMessage(objectAware.ObjectName, "NoteList", controller.WorkSpaceID));
     }
     else
     {
         throw new Exception("Note owner is not IController");
     }
 }
Ejemplo n.º 23
0
        void ViewSaved(object sender, EventArgs e)
        {
            if (!OnSave())
            {
                return;
            }
            ObjectSetChangedMessage message = new ObjectSetChangedMessage();

            message.ObjectName = ObjectType;
            if (!string.IsNullOrEmpty(_parentObjectName))
            {
                message.ParentObjectName = _parentObjectName;
            }
            EventAggregationManager.SendMessage(message);
        }
Ejemplo n.º 24
0
        private void LeadListForm_Load(object sender, EventArgs e)
        {
            ObjectGridView.InitWithDefaultLayout(ObjectName);
            RegisterEventHandlers();


            //apply formats.
            if (this.ObjectGridView is GridView)
            {
                FormatRequestMessage msg = new FormatRequestMessage();
                msg.ObjectName = this.ObjectName;
                msg.GridView   = this.ObjectGridView;
                EventAggregationManager.SendMessage <FormatRequestMessage>(msg);
            }
        }
Ejemplo n.º 25
0
        void bindingSource1_PositionChanged(object sender, EventArgs e)
        {
            var selectedObjectChanged = new SelectedObjectChangedMessage();

            selectedObjectChanged.ObjectName  = this.ObjectName;
            selectedObjectChanged.WorkSpaceID = this.WorkSpaceID;

            selectedObjectChanged.SelectedObject = ObjectGridView.GetFocusedRow();

            EventAggregationManager.SendMessage(selectedObjectChanged);
            System.Diagnostics.Debug.WriteLine(this.ObjectName + " Refreshed");

            var message = new UpdateRibbonItemMessage(this.WorkSpaceID, this.ObjectName);

            EventAggregationManager.SendMessage(message);
        }
        public bool SetOpportunityRecyle(Opportunity opportunity)
        {
            opportunity.ClosedTime     = (DateTime?)null;
            opportunity.StatusCode     = (int)OpportunityStatus.InProgress;
            opportunity.SalesStageCode = opportunity.StatusCode + SaleStageCodeOffSet;
            this._objectSpace.SaveChanges();
            ObjectSetChangedMessage msg = new ObjectSetChangedMessage();

            msg.ObjectName = this.ObjectName;
            EventAggregationManager.SendMessage(msg);

            UpdateRibbonItemMessage msgRefreshCmd = new UpdateRibbonItemMessage(this.WorkSpaceID, this.ObjectName);

            EventAggregationManager.SendMessage(msgRefreshCmd);
            return(true);
        }
Ejemplo n.º 27
0
        public override void Run()
        {
            //ActivateViewMessage message = new ActivateViewMessage { ViewName = "ProjectModule" };
            IController         controller = this.Owner as IController;
            ActivateViewMessage message    = new ActivateViewMessage(controller.WorkSpaceID, "ProjectModule");

            EventAggregationManager.SendMessage(message);

            ObjectDetailController detailController = (ObjectDetailController)this.Owner;
            var selectedObjectChanged = new SelectedObjectChangedMessage {
                ObjectName = detailController.ObjectName
            };

            selectedObjectChanged.SelectedObject = detailController.SelectedObject;
            EventAggregationManager.SendMessage(selectedObjectChanged);
        }
Ejemplo n.º 28
0
        protected override void OnLoad(EventArgs e)
        {
            var message = new ViewManageMessage
            {
                ViewName       = this.Name,
                ViewAction     = ViewAction.Add,
                RelationObject = this
            };

            EventAggregationManager.SendMessage(message);
            this.SaveDefaultLayout();
            if (this._mainController is ListController)
            {
                this.RestoreLayout();
            }
            base.OnLoad(e);
        }
        protected override void OnViewSet()
        {
            if (!(_detailView is IManageEffortDetailView))
            {
                return;
            }
            _effortDetailView = (IManageEffortDetailView)_detailView;
            _effortDetailView.OnDeleteData += OnDeleteData;
            FilterTaskList();
            InitFilter();
            _effortDetailView.Bind(_projectTaskList);
            _effortDetailView.ObjectChanged += View_ObjectChanged;
            HasChanges = false;
            var message = new UpdateRibbonItemMessage(this.WorkSpaceID, this.ObjectName);

            EventAggregationManager.SendMessage(message);
        }
Ejemplo n.º 30
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                EventAggregationManager.RemoveListener(this);
                if (_mainController != null)
                {
                    _mainController.Dispose();
                    _mainController = null;
                }
                ActionResult = null;
                ActiveView   = null;
                if (_controllers != null)
                {
                    _controllers.Clear();
                    _controllers = null;
                }
                if (_views != null)
                {
                    _views.Clear();
                    _views = null;
                }

                if (components != null)
                {
                    components.Dispose();
                }
                BindingContext = null;
                if (this._commandManager != null)
                {
                    this._commandManager.Dispose();
                    this._commandManager = null;
                }
                if (this._workspaceContext != null)
                {
                    this._workspaceContext.Dispose();
                    this._workspaceContext = null;
                }
            }
            base.Dispose(disposing);
            LoggingService.InfoFormatted(" Start SuppressFinalize WorkSpace {0}:{1}", this.ObjectName, DateTime.Now.ToString("HH:mm:ss fff"));
            GC.Collect();
            GC.SuppressFinalize(this);
            LoggingService.InfoFormatted(" End SuppressFinalize WorkSpace {0}:{1}", this.ObjectName, DateTime.Now.ToString("HH:mm:ss fff"));
        }