示例#1
0
 // called cyclically
 public void OnTimerUpdate(IElementView elementView)
 {
     if (invalid)
     {
         DrawItem();
     }
 }
 public CreateDataConnectionEventArgs(IElementView sourceElement, IElementView destinationElement, int srcPortIndex, int destPortIndex)
 {
     SourceElement = sourceElement;
     DestinationElement = destinationElement;
     DestinationPortIndex = destPortIndex;
     SourcePortIndex = srcPortIndex;
 }
示例#3
0
 public override void Enter(MouseEventContext mouseEventContext, IElementView elementView)
 {
     Log.Debug("Mouse Enter");
     hasMouseFocus = true;
     invalid       = true;
     base.Enter(mouseEventContext, elementView);
 }
示例#4
0
        public static IElementView GetView(IGameItem item, int size)
        {
            IElementView view = null;

            if (item is Fruit)
            {
                view = new FruitView(item, size);
            }
            else if (item is Poisson)
            {
                view = new PoissonView(item, size);
            }
            else if (item is SmartMouse)
            {
                view = new MouseView(item, size);
            }
            else if (item is Mouse)
            {
                view = new MouseView(item, size);
            }
            else if (item is Cat)
            {
                view = new CatView(item, size);
            }
            return(view);
        }
示例#5
0
 public void OnTimerUpdate(IElementView elementView)
 {
     if (this.updateTime != 0)
     {
         this.ExecuteCyclic();
     }
 }
示例#6
0
 public override void Leave(MouseEventContext mouseEventContext, IElementView elementView)
 {
     Log.Debug("Mouse Leave");
     hasMouseFocus = false;
     invalid       = true;
     base.Leave(mouseEventContext, elementView);
 }
 protected override void InitVisual(IElementView elementView, ulong noValueEffects)
 {
     this.view = elementView;
     visual    = new GraphicItemVisual(this);
     ItemDrawingVisual.Children.Add(visual);
     DrawItem();
 }
示例#8
0
 protected override void InitVisual(IElementView elementView, ulong noValueEffects)
 {
     this.elementView = elementView;
     this.visual      = new GraphicItemVisual(this);
     this.ItemDrawingVisual.Children.Add(this.visual);
     this.DrawItem(this.response);
 }
示例#9
0
        protected override void UpdateVisual(IElementView elementView, ulong updateReason, ulong noValueEffects)
        {
            if (this.updateTime != 0)
            {
                this.ExecuteCyclic();
            }

            this.DrawItem(this.response);
        }
示例#10
0
 // called for exit
 public override void PrepareForRemoval(IElementView elementV, int itemIndex)
 {
     terminate = true;
     if (rfb != null)
     {
         rfb.Close();
     }
     base.PrepareForRemoval(elementV, itemIndex);
 }
示例#11
0
        public async Task <IActionResult> ReadAlbumElementViewAsync(long elementId, [FromQuery] long pageId)
        {
            PageContext context = new PageContext {
                PageId = pageId
            };
            IElementView <AlbumElementSettings, AlbumElementContent> view = await _albumElementService.ReadElementViewAsync(TenantId, elementId, context);

            if (view == null)
            {
                return(NotFound());
            }
            return(Ok(view));
        }
示例#12
0
        public async Task <IActionResult> ReadBorrowCalculatorElementViewAsync(long elementId, [FromQuery] long pageId)
        {
            PageContext context = new PageContext {
                PageId = pageId
            };
            IElementView <BorrowCalculatorElementSettings, object> view = await _borrowCalculatorElementService.ReadElementViewAsync(TenantId, elementId, context);

            if (view == null)
            {
                return(NotFound());
            }
            return(Ok(view));
        }
示例#13
0
        public async Task <IActionResult> ReadTagCloudElementViewAsync(long elementId, [FromQuery] long pageId, [FromQuery] string tagIds)
        {
            IEnumerable <long> tagIdCollection = !string.IsNullOrWhiteSpace(tagIds) ? tagIds.Split(',').Select(long.Parse) : null;
            PageContext        context         = new PageContext {
                PageId = pageId, TagIds = tagIdCollection
            };
            IElementView <TagCloudElementSettings, TagCloudElementContent> view = await _tagCloudElementService.ReadElementViewAsync(TenantId, elementId, context);

            if (view == null)
            {
                return(NotFound());
            }
            return(Ok(view));
        }
示例#14
0
        private async Task <IElementViewModel> GetElementViewModelAsync <TSettings, TContent>(long tenantId, long elementId, IPageContext context, Func <long, long, IPageContext, Task <IElementView <TSettings, TContent> > > func) where TSettings : IElementSettings
        {
            IElementView view = await func(tenantId, elementId, context);

            if (view == null)
            {
                return(null);
            }
            return(new ElementViewModel <TSettings, TContent>
            {
                View = view,
                Context = context
            });
        }
 // called cyclically
 public void OnTimerUpdate(IElementView elementView)
 {
     pos = (dir ? pos + speed : pos - speed);
     if (pos < 0)
     {
         pos = 0;
         dir = true;
     }
     if (pos > 300)
     {
         pos = 300;
         dir = false;
     }
     DrawItem();
 }
示例#16
0
 // called for init
 protected override void InitVisual(IElementView elementView, ulong noValueEffects)
 {
     Log.Debug("InitVisual");
     view   = elementView;
     visual = new GraphicItemVisual(this);
     ItemDrawingVisual.Children.Add(visual);
     view.Viewer.PreviewKeyDown    += new KeyEventHandler(Viewer_PreviewKeyDown);
     view.Viewer.PreviewKeyUp      += new KeyEventHandler(Viewer_PreviewKeyUp);
     view.Viewer.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Viewer_LostKeyboardFocus);
     view.Viewer.GotKeyboardFocus  += new KeyboardFocusChangedEventHandler(Viewer_GotKeyboardFocus);
     font        = new LogicalFont("Arial", 18.0, AfwDynamicGraphics.Media.FontStyle.Regular).GetFont(view);
     hasKeyFocus = view.Viewer.IsKeyboardFocusWithin;
     new Thread(RunNetThread).Start();
     DrawItem();
 }
示例#17
0
        public async Task <IActionResult> ReadPageListElementViewAsync(long elementId, [FromQuery] long pageId, [FromQuery] string tagIds, [FromQuery] string page)
        {
            IEnumerable <long>           tagIdCollection = !string.IsNullOrWhiteSpace(tagIds) ? tagIds.Split(',').Select(long.Parse) : null;
            IDictionary <string, string> parameters      = page != null ? new Dictionary <string, string> {
                { "page", page }
            } : null;
            PageContext context = new PageContext {
                PageId = pageId, Parameters = parameters, TagIds = tagIdCollection
            };
            IElementView <PageListElementSettings, PageListElementContent> view = await _pageListElementService.ReadElementViewAsync(TenantId, elementId, context);

            if (view == null)
            {
                return(NotFound());
            }
            return(Ok(view));
        }
示例#18
0
 public IElementPresenter Create(IElement element, IElementView view)
 {
     if (element!=null && view!=null)
     {
         if (element is ISimpleElement && view is ISimpleElementView)
         {
             return Create(element as ISimpleElement, view as ISimpleElementView);
         }
         else if (element is ICompoundElement && view is ICompoundElementView)
         {
             return Create(element as ICompoundElement, view as ICompoundElementView);
         }
         else if (element is IProcedure && view is IProcedureView)
         {
             return Create(element as IProcedure, view as IProcedureView);
         }
     }
     return null;
 }
示例#19
0
 public override void MouseWheel(MouseEventContext mouseEventContext, IElementView elementView)
 {
     base.MouseWheel(mouseEventContext, elementView);
 }
 public CreateDataConnectionEventArgs(IElementView sourceElement, IElementView destinationElement)
     : this(sourceElement, destinationElement, -1, -1)
 {
 }
示例#21
0
 internal void _View_SelectionChanged(IElementView sender, SelectionEventArgs ea)
 {
     if (sender != null)
     {
         // the change originated at the UI level and has already been applied at the UI level.
         if (_Element.IsSelected != ea.IsSelected)
         {
             // propagate the selection change to the model if the Source is a UI source:  Mouse, Keyboard, UserInput
             if (ea.Source == SelectionSource.Mouse)
             {
                 _Element.SetIsSelected(ea.IsSelected, ea.Source, ea.Origin);
                 VerifySelectionStates(_View, _Element);
             }
             else if (ea.Source == SelectionSource.KeyBoard)
             {
                 _Element.SetIsSelected(ea.IsSelected, ea.Source, ea.Origin);
                 VerifySelectionStates(_View, _Element);
             }
             else if (ea.Source == SelectionSource.UserInput)
             {
                 _Element.SetIsSelected(ea.IsSelected, ea.Source, ea.Origin);
                 VerifySelectionStates(_View, _Element);
             }
         }
     }
 }
示例#22
0
        internal void LoadNetworkPipePresenterAndModel(INetworkPipe pipe, INetworkPipeView pipeView, IElementView srcElView, IElementView destElView, int srcPortIndex, int destPortIndex)
        {
            Guid srcElId = srcElView.Id;
            Guid destElId = destElView.Id;

            // connect the pipe to the elements, at the model (biz) level.
            IOutputNetworkPort srcPort = GetSourceNetworkPort(srcElId, srcPortIndex);
            IInputNetworkPort destPort = GetDestinationNetworkPort(destElId, destPortIndex);
            ConnectPipeModel(pipe, srcPort, destPort);

            // set the id of the pipeView to the id of the pipe model
            pipeView.Id = pipe.Id;

            // create the instance of the presenter with the model and the view
            INetworkPipePresenter presenter = CreateNetworkPipePresenter(pipe, pipeView);

            // Add the pipe presenter to the presenter mgr,and the view to the workspace view.
            // Pipe model has already been added to workspace during unpersisting.
            if (presenter != null)
            {
                View.Add(pipeView, srcElView, destElView, srcPortIndex, destPortIndex);
                PipePresenters.Add(pipe.Id, presenter);
            }
        }
示例#23
0
        public static IHtmlContent FormatHtmlElementHtml(this IHtmlHelper htmlHelper, IElementView <HtmlElementSettings, HtmlElementContent> view)
        {
            if (string.IsNullOrWhiteSpace(view.Content.FormattedHtml))
            {
                return(new HtmlString(string.Empty));
            }

            IUrlHelper        urlHelper  = new UrlHelper(htmlHelper.ViewContext);
            HtmlElementHelper helper     = new HtmlElementHelper(view, urlHelper);
            IStringUtilities  utilitites = new StringUtilities();
            string            html       = utilitites.BlockReplace(view.Content.FormattedHtml, "[[{", "}]]", helper.Replace);

            return(new HtmlString(html));
        }
示例#24
0
        internal void CreateNetworkConnectionFromView(IElementView srcElView, IElementView destElView, int srcPortIndex, int destPortIndex)
        {
            // create the instance of the view
            INetworkPipeView view = CreateNetworkPipeView();

            CreateNetworkPipePresenterAndModel(view, srcElView, destElView, srcPortIndex, destPortIndex);
        }
示例#25
0
 /// <summary>
 /// Verifies both the <paramref name="view"/> and the <paramref name="model"/> have the
 /// same selected setting.
 /// </summary>
 /// <param name="view"></param>
 /// <param name="model"></param>
 private void VerifySelectionStates(IElementView view, IElement model)
 {
     if (view.IsSelected != model.IsSelected)
     {
         throw new InvalidOperationException("Both the view and model must have the same selected value!");
     }
 }
示例#26
0
 // TODO REMOVE
 internal void _View_ExecuteButtonClicked(IElementView sender, ButtonClickEventArgs ea)
 {
     // TODO REMOVE
     throw new NotImplementedException();
     if (sender!=null)
     {
         Element.Execute();
     }
 }
 public CompleteNetworkConnectionEventArgs(INetworkPipeView networkPipeView, IElementView sourceElement, IElementView destinationElement, int srcPortIndex, int destPortIndex)
     : base(sourceElement, destinationElement, srcPortIndex, destPortIndex)
 {
     NetworkPipeView = networkPipeView;
 }
示例#28
0
 // returns a new instance
 public override GraphicItem GetRunTimeInstance(IElementView elementView, GraphicItemVisual visual)
 {
     return(new PG2VNCViewer(this, visual));
 }
示例#29
0
        public IElementPresenter AddElementInstance(IElementDefinition definition, IElementView view)
        {
            // create the instance of the element
            IElement el = CreateElementModel(definition);

            // create the instance of the element presenter with the element and the view
            IElementPresenter presenter = CreateElementPresenter(el, view);

            // add the element to the workspace.ElementMgr and the view to the workspace view
            if (presenter != null)
            {
                ElementPresenters.Add(el.Id, presenter);
                WorkSpace.ElementsMgr.Add(el);
                UpdateElementLocation(el, view.Location);
            }
            return presenter;
        }
示例#30
0
 // TODO REMOVE
 internal void _View_SettingsButtonClicked(IElementView sender, ButtonClickEventArgs ea)
 {
     // TODO REMOVE
     throw new NotImplementedException();
     if (sender!=null)
     {
        //     CustomizationsViewToggle(); //XXX
     }
 }
示例#31
0
 internal void _view_DeleteElementInstance(IElementView sender, DeleteElementInstanceEventArgs ea)
 {
     // pass the ref of the element to delete on to the workspace for actual deletion
     if (sender!=null)
     {
         WorkSpace.ElementsMgr.Remove(ea.Element);
     }
 }
示例#32
0
 // called if update required
 protected override void UpdateVisual(IElementView elementView, ulong updateReason, ulong noValueEffects)
 {
     DrawItem();
 }
示例#33
0
        internal IElementPresenter CreateElementPresenter(IElement model, IElementView view)
        {
            IElementPresenter pesenter = null;
            if (model != null && view != null)
            {
                // create the instance of the element presenter with the element and the view
                using (ElementPresenterFactory presFac = new ElementPresenterFactory())
                {
                    pesenter = presFac.Create(model, view);
                }
            }

            return pesenter;
        }
示例#34
0
 public AddPipeInstanceEventArgs(IElementView srcEl, IElementView destEl)
 {
     SourceElement = srcEl;
     DestinationElement = destEl;
 }
示例#35
0
        internal void CreateNetworkPipePresenterAndModel(INetworkPipeView pipeView, IElementView srcElView, IElementView destElView, int srcPortIndex, int destPortIndex)
        {
            //TODO XXX REMOVE
            Guid newPipeId = GetNewId();
            Guid srcElId = srcElView.Id;
            Guid destElId = destElView.Id;

            // create the pipe model
            INetworkPipe pipe = CreateNetworkPipeModel(newPipeId);

            // connect the pipe to the elements, at the model (biz) level.  First we need to get the elemetns:
            IOutputNetworkPort srcPort = GetSourceNetworkPort(srcElId, srcPortIndex);
            IInputNetworkPort destPort = GetDestinationNetworkPort(destElId, destPortIndex);
            ConnectPipeModel(pipe, srcPort, destPort);

            // create the instance of the view
            pipeView.Id = pipe.Id;

            // create the instance of the presenter with the model and the view
            INetworkPipePresenter presenter = CreateNetworkPipePresenter(pipe, pipeView);

            // Add the pipe to the workspace.ElementMgr and the persenter to the presenter mgr.
            // The pipeView is already in the workspace view.
            if (presenter != null)
            {
                WorkSpace.PipesMgr.Add(pipe);
                PipePresenters.Add(pipe.Id, presenter);
            }
        }
示例#36
0
 public override void Enter(MouseEventContext mouseEventContext, IElementView elementView)
 {
     this.hasMouseFocus = true;
     base.Enter(mouseEventContext, elementView);
 }
示例#37
0
 public HtmlElementHelper(IElementView <HtmlElementSettings, HtmlElementContent> view, IUrlHelper urlHelper)
 {
     _view      = view;
     _urlHelper = urlHelper;
 }
示例#38
0
 // TODO REMOVE
 internal void _View_ElementViewReset(IElementView sender, ElementViewResetEventArgs ea)
 {
     if (sender != null)
     {
         Element.Reset();
     }
 }
 public CompleteDataConnectionEventArgs(IDataPipeView dataPipeView, IElementView sourceElement, IElementView destinationElement, int srcPortIndex, int destPortIndex)
     : base(sourceElement, destinationElement, srcPortIndex, destPortIndex)
 {
     DataPipeView = dataPipeView;
 }
示例#40
0
 public override void Leave(MouseEventContext mouseEventContext, IElementView elementView)
 {
     this.hasMouseFocus = false;
     base.Leave(mouseEventContext, elementView);
 }
示例#41
0
 public override void MouseUp(MouseEventContext mouseEventContext, IElementView elementView)
 {
     MouseUpdate(mouseEventContext, true);
     base.MouseUp(mouseEventContext, elementView);
 }
示例#42
0
 internal void _View_PortViewSelectionChanged(IElementView sender, PortViewSelectionEventArgs ea)
 {
     // Not Currently Used.
     throw new Exception("The method or operation is not implemented.");
 }
示例#43
0
 // mouse handling - 800xA side
 public override bool IsMouseEventConsumer(IElementView elementView)
 {
     return(true);
 }
示例#44
0
 // TODO REMOVE
 internal void _View_ExecuteButtonClicked(IElementView sender, ButtonClickEventArgs ea)
 {
     // ExecutionToggle();
 }