예제 #1
0
 // called cyclically
 public void OnTimerUpdate(IElementView elementView)
 {
     if (invalid)
     {
         DrawItem();
     }
 }
예제 #2
0
 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);
 }
예제 #20
0
 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();
     }
 }
예제 #39
0
 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();
 }