예제 #1
0
        public ServerMonitorView(IViewContext viewContext, ServerMonitorViewModel serverMonitorViewModel)
            : base(viewContext, serverMonitorViewModel, DashboardModule.ModuleName)
        {
            InitializeComponent();

            DataContext = serverMonitorViewModel;
        }
예제 #2
0

        
        public CustomerRemediationView(IViewContext viewContext, CustomerRemediationViewModel customerRemediationViewModel)
            : base(viewContext, customerRemediationViewModel, Module.ModuleName)
        {
            InitializeComponent();

            DataContext = customerRemediationViewModel;
        }
예제 #4
0
        public void Handle(IViewContext context, UserDetailsUpdated domainEvent)
        {
            var user = FindInternalUserProfile(domainEvent);

            user.FirstName = domainEvent.FirstName;
            user.LastName  = domainEvent.LastName;
        }
예제 #5
0
            public void Handle(IViewContext context, NumberEvent domainEvent)
            {
                var aggregateRootId = domainEvent.GetAggregateRootId();
                var instance        = context.Load <AggregateRootWithLogic>(aggregateRootId);

                Counter = instance.Counter;
            }
        public ConfigureAuthorisationView(IViewContext viewContext, ConfigurationAuthorisationViewModel configurationAuthorisationViewModel)
            : base (viewContext, configurationAuthorisationViewModel, Module.ModuleName)
        {
            InitializeComponent();

            DataContext = configurationAuthorisationViewModel;
        }
예제 #7
0
 public void Handle(IViewContext context, MemberRegisteredToAssociation domainEvent)
 {
     AssociationMembers.Add(new AssociationMember
     {
         Id = domainEvent.MemberId
     });
 }
예제 #8
0
        protected override void OnDataBindingComplete(DataGridViewBindingCompleteEventArgs e)
        {
            var bindingListSource = DataSource as BindingListSource;
            var newViewContext    = bindingListSource == null ? null : bindingListSource.ViewContext;

            if (!ReferenceEquals(_viewContext, newViewContext))
            {
                if (_viewContext != null)
                {
                    DataError -= _viewContext.OnDataError;
                }
                _viewContext = newViewContext;
                if (_viewContext != null)
                {
                    DataError += _viewContext.OnDataError;
                }
            }
            if (!ReferenceEquals(_bindingListSource, bindingListSource))
            {
                if (_bindingListSource != null)
                {
                    _bindingListSource.AllRowsChanged -= BindingListSourceOnAllRowsChanged;
                    _bindingListSource.ColumnFormats.FormatsChanged -= OnFormatsChanged;
                }
                _bindingListSource = bindingListSource;
                if (_bindingListSource != null)
                {
                    _bindingListSource.AllRowsChanged += BindingListSourceOnAllRowsChanged;
                    _bindingListSource.ColumnFormats.FormatsChanged += OnFormatsChanged;
                }
            }
            UpdateColumns();
            base.OnDataBindingComplete(e);
        }
예제 #9
0
        protected override void Initialize(IViewContext context)
        {
            ClientId = Guid.NewGuid().ToString();

            _removeReportAction = SdlTradosStudio.Application.GetAction <RemoveReportAction>();
            _addReportAction    = SdlTradosStudio.Application.GetAction <AddReportAction>();
            _editReportAction   = SdlTradosStudio.Application.GetAction <EditReportAction>();
            _openSettingsAction = SdlTradosStudio.Application.GetAction <OpenSettingsAction>();
            //_pageSetupAction = SdlTradosStudio.Application.GetAction<PageSetupAction>();
            //_printPreviewReportAction = SdlTradosStudio.Application.GetAction<PrintPreviewReportAction>();
            _printReportAction  = SdlTradosStudio.Application.GetAction <PrintReportAction>();
            _refreshAction      = SdlTradosStudio.Application.GetAction <RefreshAction>();
            _saveAsReportAction = SdlTradosStudio.Application.GetAction <SaveAsReportAction>();

            _pathInfo         = new PathInfo();
            ReportsController = ReportsController.Instance;
            ReportsController.ReportsChanging        += Controller_ReportsChanging;
            ReportsController.ReportsChanged         += Controller_ReportsChanged;
            ReportsController.ReportsAdded           += Controller_ReportsAdded;
            ReportsController.ReportsRemoved         += Controller_ReportsRemoved;
            ReportsController.ReportsUpdated         += Controller_ReportsUpdated;
            ReportsController.ReportTemplatesChanged += Controller_ReportTemplatesChanged;

            ActivationChanged += ReportsViewerController_ActivationChanged;
        }
        public TradeServerManagerView(IViewContext viewContext, TradeServerManagerViewModel serverManagerViewModel)
            : base(viewContext, serverManagerViewModel, ConfigurationModule.ModuleName)
        {
            InitializeComponent();

            DataContext = serverManagerViewModel;
        }
예제 #11
0
        public void DispatchToView(IViewContext context, DomainEvent domainEvent, TViewInstance view)
        {
            var lastGlobalSequenceNumber = domainEvent.GetGlobalSequenceNumber();

            if (lastGlobalSequenceNumber <= view.LastGlobalSequenceNumber)
            {
                return;
            }

            var domainEventType = domainEvent.GetType();

            var dispatcherMethod = _dispatcherMethods
                                   .GetOrAdd(domainEventType, type => _dispatchToViewGenericMethod.MakeGenericMethod(domainEventType));

            try
            {
                _logger.Debug("Dispatching event {0} to {1} with ID {2}", lastGlobalSequenceNumber, view, view.Id);

                context.CurrentEvent = domainEvent;

                dispatcherMethod.Invoke(this, new object[] { context, domainEvent, view });

                view.LastGlobalSequenceNumber = lastGlobalSequenceNumber;
            }
            catch (Exception exception)
            {
                throw new ApplicationException(string.Format("Could not dispatch {0} to {1}", domainEvent, view), exception);
            }
        }
예제 #12
0
        public ExampleDocumentView(IViewContext viewContext, ExampleDocumentViewModel exampleDocumentViewModel)
            : base(viewContext, exampleDocumentViewModel, Module.ModuleName)
        {
            InitializeComponent();

            DataContext = exampleDocumentViewModel;
        }
예제 #13
0
        public NewDocumentView(IViewContext viewContext, NewDocumentViewModel newDocumentViewModel)
            : base(viewContext, newDocumentViewModel, Module.ModuleName)
        {
            InitializeComponent();

            DataContext = newDocumentViewModel;
        }
예제 #14
0
 public ManageViewsForm(IViewContext viewContext)
 {
     InitializeComponent();
     ViewContext = viewContext;
     Icon = ViewContext.ApplicationIcon;
     RefreshUi(true);
 }
예제 #15
0
 public void Dispatch(IViewContext viewContext, IEnumerable <DomainEvent> batch, IViewManagerProfiler viewManagerProfiler)
 {
     foreach (var e in batch)
     {
         _position = e.GetGlobalSequenceNumber();
     }
 }
예제 #16
0
 public ViewEditor(IViewContext viewContext, ViewInfo viewInfo)
 {
     InitializeComponent();
     ViewContext = viewContext;
     ViewInfo = OriginalViewInfo = viewInfo;
     _undoIndex = 0;
     _undoStack = new List<KeyValuePair<ViewInfo, IList<PropertyPath>>>();
     SetViewInfo(ViewInfo, new PropertyPath[0]);
     tbxViewName.Text = ViewSpec.Name;
     Icon = ViewContext.ApplicationIcon;
     _chooseColumnsTab = new ChooseColumnsTab {Dock = DockStyle.Fill};
     tabPageColumns.Controls.Add(_chooseColumnsTab);
     _filterTab = new FilterTab { Dock = DockStyle.Fill };
     tabPageFilter.Controls.Add(_filterTab);
     _sourceTab = new SourceTab{Dock = DockStyle.Fill};
     tabPageSource.Controls.Add(_sourceTab);
     _editorWidgets.AddRange(new ViewEditorWidget[] { _chooseColumnsTab, _filterTab, _sourceTab });
     foreach (var tab in _editorWidgets)
     {
         tab.SetViewEditor(this);
     }
     toolButtonShowAdvanced.Checked = ShowHiddenFields;
     if (!ShowHiddenFields)
     {
         tabControl1.TabPages.Remove(tabPageSource);
     }
 }
예제 #17
0
 public void Handle(IViewContext context, UserCreated domainEvent)
 {
     UserProfiles.Add(new UserProfile
     {
         Id = domainEvent.GetAggregateRootId()
     });
 }
예제 #18
0
        public UserAccountsView(IViewContext viewContext, UserAccountsViewModel userAccountsViewModel)
            : base(viewContext, userAccountsViewModel, Module.ModuleName)
        {
            InitializeComponent();

            DataContext = userAccountsViewModel;
        }
예제 #19
0
        public StrategyManagerView(IViewContext viewContext, StrategyManagerViewModel strategyManagerViewModel)
            : base(viewContext, strategyManagerViewModel, Module.ModuleName)
        {
            InitializeComponent();

            DataContext = strategyManagerViewModel;
        }
예제 #20
0

        
예제 #21
0

        
        public void Handle(IViewContext context, CountingRootIncremented domainEvent)
        {
            Console.WriteLine("Loading aggregate root");
            var root = context.Load <CountingRoot>(domainEvent.GetAggregateRootId());

            Console.WriteLine($"Got the number {root.Number} from it");
            Number = root.Number;
        }
예제 #23
0
            protected override IEnumerable <string> GetViewIds(IViewContext context, DomainEvent e)
            {
                yield return("some");

                yield return("known");

                yield return("ids");
            }
예제 #24
0
 public ManageViewsForm(IViewContext viewContext)
 {
     InitializeComponent();
     ViewContext = viewContext;
     Icon        = ViewContext.ApplicationIcon;
     chooseViewsControl1.ViewContext = viewContext;
     UpdateButtons();
 }
예제 #25
0
 public ManageViewsForm(IViewContext viewContext)
 {
     InitializeComponent();
     ViewContext = viewContext;
     Icon = ViewContext.ApplicationIcon;
     chooseViewsControl1.ViewContext = viewContext;
     UpdateButtons();
 }
예제 #26
0
 public TableInformationCollectionView(IViewContext viewContext)
     : base(viewContext, TableInformationCollectionPresenterFactory.Factory)
 {
     InitializeComponent();
     DataGridViewDetail  = null;
     BindingSourceDetail = null;
     Title = "MaterialType";
 }
예제 #27
0
            public void Handle(IViewContext context, RootEvent domainEvent)
            {
                var aggregateRootId = domainEvent.GetAggregateRootId();

                EventCounts[aggregateRootId] = EventCounts.ContainsKey(aggregateRootId)
                    ? EventCounts[aggregateRootId] + 1
                    : 1;
            }
        public MainFormViewModel(ApplicationContext applicationContext, IViewContext viewContext)
        {
            this.applicationContext = applicationContext;
            this.viewContext = viewContext;

            BitcoinNode = new BitcoinNodeViewModel(applicationContext, viewContext);
            PaperWallet = new PaperWalletViewModel(viewContext);
        }
예제 #29
0
        public void Handle(IViewContext context, AddressAddedToAssociation domainEvent)
        {
            var address = new AssociationAddress();

            address.MapFromEvent(domainEvent);

            _addresses.Add(address);
        }
예제 #30
0
 public static T Get <T>(this IViewContext context) where T : class
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     return(Get <T>(context, typeof(T).FullName));
 }
예제 #31
0
 internal Task <T> CreateAndStartAsyncInternal <T>(object arg = null,
                                                   IControllerFactory factory = null,
                                                   CancellationToken token    = default,
                                                   IViewContext viewContext   = null)
     where T : ControllerBase
 {
     return(CreateAndStartAsyncInternal <T>(typeof(T), arg, factory, token, viewContext));
 }
 /// <summary>
 /// Evaluates whether the field should be shown or hidden. If this method returns null, the next filter attribute will be evaluated.
 /// </summary>
 public VisibilityMode?CanShow(IViewContext viewContext)
 {
     if (ViewNames.Contains(viewContext.ViewName, StringComparer.CurrentCultureIgnoreCase))
     {
         return(Mode);
     }
     return(null);
 }
예제 #33
0
 public AppointmentOrderFactorCollectionView(IViewContext viewContext)
     : base(viewContext, AppointmentOrderFactorCollectionPresenterFactory.Factory)
 {
     InitializeComponent();
     DataGridViewDetail  = null;
     BindingSourceDetail = null;
     Title = "MaterialType";
 }
예제 #34
0
 /// <summary>
 /// Evaluates whether the field should be shown or hidden. If this method returns null, the next filter attribute will be evaluated.
 /// </summary>
 public VisibilityMode?CanShow(IViewContext viewContext)
 {
     if (viewContext.CurrentUser != null && RoleNames.Any(viewContext.CurrentUser.IsInRole))
     {
         return(Mode);
     }
     return(null);
 }
 public void Dispatch(IViewContext viewContext, IEnumerable <DomainEvent> batch, IViewManagerProfiler viewManagerProfiler)
 {
     foreach (var e in batch)
     {
         _position = e.GetGlobalSequenceNumber();
         Console.WriteLine("TestViewManager: position = {0}", _position);
     }
 }
예제 #36
0
        public void Handle(IViewContext context, CodeAssignedToAddress domainEvent)
        {
            var associationId = domainEvent.GetAggregateRootId();

            var address = GetAssociationAddressList(associationId).FirstOrDefault(a => a.Id == domainEvent.AddressId);

            address.Codes.Add(domainEvent.Code);
        }
 /// <summary>
 /// Evaluates whether the field should be shown or hidden. If this method returns null, the next filter attribute will be evaluated.
 /// </summary>
 public VisibilityMode?CanShow(IViewContext viewContext)
 {
     if (viewContext.CurrentUser?.Identity?.IsAuthenticated == true)
     {
         return(Mode);
     }
     return(null);
 }
예제 #38
0
 protected override IEnumerable<string> GetViewIds(IViewContext context, DomainEvent e)
 {
     if (e is JustAnEvent)
     {
         yield return "yay";
     }
     else
     {
         throw new ApplicationException("oh noes!!!!");
     }
 }
예제 #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DocumentViewBase"/> class.
 /// </summary>
 /// <param name="viewContext">The view context.</param>
 /// <param name="authorisationViewModel">The view model.</param>
 /// <param name="moduleName">The mudule name.</param>
 protected DocumentViewBase(IViewContext viewContext, DocumentViewModel authorisationViewModel, string moduleName)
     : base(viewContext)
 {
     ModuleName = moduleName;
     authorisationViewModel.ViewModelContext.UiDispatcher = Dispatcher;
     authorisationViewModel.Activate += ViewModelActivate;
     authorisationViewModel.ShowMessageWindow += ShowMessageBox;
     authorisationViewModel.ShowModalWindow += ShowModalWindow;
     authorisationViewModel.NavigateTarget += NavigateTarget;
     authorisationViewModel.GetViewModels += GetViewModels;
     authorisationViewModel.Publish += Publish;
 }
예제 #40
0
 public ViewColumn(IViewContext viewContext, ColumnPropertyDescriptor columnPropertyDescriptor, DataGridViewCell cellTemplate) : base(cellTemplate)
 {
     ViewContext = viewContext;
     ColumnPropertyDescriptor = columnPropertyDescriptor;
     SortMode = DataGridViewColumnSortMode.Automatic;
     if (columnPropertyDescriptor != null)
     {
         HeaderText = columnPropertyDescriptor.DisplayName;
         DataPropertyName = columnPropertyDescriptor.Name;
         Name = columnPropertyDescriptor.Name;
     }
 }
        protected override IEnumerable<string> GetViewIds(IViewContext context, DomainEvent e)
        {
            if (!(e is NodeAttachedToParentNode)) throw new ArgumentException(String.Format("Can't handle {0}", e));

            var node = context.Load<Node>(e.GetAggregateRootId());

            while (node.ParentNodeId != null)
            {
                node = context.Load<Node>(node.ParentNodeId);
            }

            return new[] { node.Id };
        }
예제 #42
0
        public SubscriptionViewModel(IViewContext clientViewContext, Guid subscriptionId, SubscriptionKind kind, string paramUri)
        {
            _viewContext = new EntileViewContext(clientViewContext);

            _subscriptionId = subscriptionId;
            _viewContext.SetValue("SubscriptionId", _subscriptionId);

            RegisterLinkAction("Unsubscribe", l =>
                                              {
                                                  var action = new UnsubscribeCommand(_viewContext, l.Uri);
                                                  UnsubscribeCommand = action;
                                              });
            _kind = kind;
            _paramUri = paramUri;
        }
예제 #43
0
        protected override IEnumerable<string> GetViewIds(IViewContext context, DomainEvent e)
        {
            var handlerMethod = _handlerMethodsByDomainEventType.GetOrAdd(e.GetType(), GetHandlerMethodFor);

            if (handlerMethod == null) return new string[0];

            try
            {
                var ids = ((IEnumerable<string>)handlerMethod.Invoke(this, new object[] { context, e })).ToList();

                return ids;
            }
            catch (Exception exception)
            {
                throw new ApplicationException(string.Format("Could not get IDs for domain event {0}!", e), exception);
            }
        }
예제 #44
0
 protected override void OnDataBindingComplete(DataGridViewBindingCompleteEventArgs e)
 {
     var bindingListSource = DataSource as BindingListSource;
     var newViewContext = bindingListSource == null ? null : bindingListSource.ViewContext;
     if (!ReferenceEquals(_viewContext, newViewContext))
     {
         if (_viewContext != null)
         {
             DataError -= _viewContext.OnDataError;
         }
         _viewContext = newViewContext;
         if (_viewContext != null)
         {
             DataError += _viewContext.OnDataError;
         }
     }
     UpdateColumns();
     base.OnDataBindingComplete(e);
 }
예제 #45
0
 public void SetViewContext(IViewContext viewContext, ViewInfo viewInfo)
 {
     ViewContext = viewContext;
     if (null == viewInfo)
     {
         BindingListView.ViewInfo = null;
     }
     else
     {
         IEnumerable rowSource = null;
         if (null != ViewInfo)
         {
             if (ViewInfo.RowSourceName == viewInfo.RowSourceName)
             {
                 rowSource = RowSource;
             }
         }
         rowSource = rowSource ?? viewContext.GetRowSource(viewInfo);
         BindingListView.SetViewAndRows(viewInfo, rowSource);
     }
     OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
 }
 public BitcoinNodeViewModel(ApplicationContext applicationContext, IViewContext viewContext)
 {
     this.applicationContext = applicationContext;
     this.viewContext = viewContext;
     UpdateValues();
 }
예제 #47
0
파일: ViewBase.cs 프로젝트: WELL-E/origin
 /// <summary>
 /// Initializes a new instance of the <see cref="ViewBase"/> class.
 /// </summary>
 /// <param name="viewContext">The view context.</param>
 protected ViewBase(IViewContext viewContext)
 {
     ViewContext = viewContext;
     Logger = ViewContext.Logger;
 }
예제 #48
0
 protected override IEnumerable<string> GetViewIds(IViewContext context, DomainEvent e)
 {
     return ViewInstanceIds;
 }
        public void OnBeforeView(IView view, IViewContext viewContext)
        {
            var startDateTime = DateTime.UtcNow;
            var actionDescriptor = ConvertActionDescriptor(viewContext.ActionDescriptor);
            
            var message = new BeforeActionViewInvokedMessage
            {
                ActionId = actionDescriptor.Id,
                ActionName = actionDescriptor.Name,
                ActionControllerName = actionDescriptor.ControllerName,
                ViewPath = view.Path,
                //ViewData = new ViewResult {      // TODO: because we switch threads, we need to make sure we get
                //    ViewData = result.ViewData,  //       what we need off the thread before publishing
                //    TempData = result.TempData
                //},
                ViewStartTime = startDateTime
            };

            _broker.BeginLogicalOperation(message, startDateTime);
            _broker.SendMessage(message);
        }
        public void OnAfterView(IView view, IViewContext viewContext)
        {
            var timing = _broker.EndLogicalOperation<BeforeActionViewInvokedMessage>();
            if (timing != null)
            {
                var actionDescriptor = ConvertActionDescriptor(viewContext.ActionDescriptor);

                var message = new AfterActionViewInvokedMessage
                {
                    ActionId = actionDescriptor.Id,
                    ActionName = actionDescriptor.Name,
                    ActionControllerName = actionDescriptor.ControllerName,
                    ViewEndTime = timing.End,
                    ViewDuration = timing.Elapsed,
                    ViewOffset = timing.Offset
                };

                _broker.SendMessage(message);
            }
            else
            {
                _logger.LogCritical("OnAfterView: Couldn't publish `AfterActionViewInvokedMessage` as `BeforeActionViewInvokedMessage` wasn't found in stack");
            }
        }
예제 #51
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModalViewBase"/> class.
 /// </summary>
 /// <param name="viewContext"></param>
 protected ModalViewBase(IViewContext viewContext)
     : base(viewContext)
 {
 }
예제 #52
0
 protected override IEnumerable<string> GetViewIds(IViewContext context, DomainEvent e)
 {
     return e.Meta.Keys.ToArray();
 }
 protected override IEnumerable<string> GetViewIds(IViewContext context, DomainEvent e)
 {
     return new[] {e.Meta[DomainEvent.MetadataKeys.AggregateRootId]};
 }
예제 #54
0
 public ClientQuery(IViewContext viewContext, string uri)
     : base(viewContext, uri)
 {
 }
예제 #55
0
 public RegisterClientCommand(IViewContext viewContext, string uri)
     : base(viewContext, uri)
 {
 }
예제 #56
0
 public ViewColumn(IViewContext viewContext, ColumnPropertyDescriptor columnPropertyDescriptor)
     : this(viewContext, columnPropertyDescriptor, new ViewCell())
 {
 }
예제 #57
0
 public UnsubscribeCommand(IViewContext viewContext, string uri)
     : base(viewContext, uri)
 {
 }
예제 #58
0
 public ExampleModalView(IViewContext viewContext)
     : base(viewContext)
 {
     InitializeComponent();
 }
예제 #59
0
 protected override void Initialize(IViewContext context)
 {
     
     ActivationChanged += JobsView_ActivationChanged;
 }