Ejemplo n.º 1
0
        // bounding box testing =============================================

        // indicator drawing
        public void DrawIndicator(Effect effect, WatchView view)
        {
            foreach (IndicatorGroup inds in indicatorView[view])
            {
                inds.Draw(effect);
            }
        }
Ejemplo n.º 2
0
    public async Task ClearNotificationsAsync(WatchView watch, long uid)
    {
        using var search = dbFactory.CreateSearch();
        var getRequest = new Func <string, SearchRequest>(t => new SearchRequest()
        {
            type   = t,
            fields = "id,contentId",
            query  = "contentId = @cid",
            order  = "id_desc",
            limit  = 1
        });
        var getValues = new Func <Dictionary <string, object> >(() => new Dictionary <string, object> {
            { "cid", watch.contentId }
        });

        //Need the latest values for comment and activity. Don't care if message is a module
        //message, the id will still be valid for tracking purposes
        var messages = await search.SearchSingleType <MessageView>(uid, getRequest("message"), getValues());

        var activity = await search.SearchSingleType <ActivityView>(uid, getRequest("activity"), getValues());

        if (messages.Count > 0)
        {
            watch.lastCommentId = messages.First().id;
        }
        if (activity.Count > 0)
        {
            watch.lastActivityId = activity.First().id;
        }
    }
Ejemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();

            outputView = new OutputView(this);

            registersView = new RegisterView(this);

            displayView = new DisplayView(this);
            controlView = new ControlView(this);

            callStackView  = new CallStackView(this);
            stackFrameView = new StackFrameView(this);

            statusView      = new StatusView(this);
            symbolView      = new SymbolView(this);
            watchView       = new WatchView(this);
            breakPointView  = new BreakpointView(this);
            instructionView = new InstructionView(this);
            methodView      = new MethodView(this);

            //scriptView = new ScriptView(this);

            sourceView     = new SourceView(this);
            sourceDataView = new SourceDataView(this);

            AppLocations.FindApplications();
            LauncherOptions.EnableQemuGDB = true;
        }
Ejemplo n.º 4
0
        public MainForm()
        {
            InitializeComponent();

            outputView = new OutputView(this);

            registersView = new RegisterView(this);

            displayView = new DisplayView(this);
            controlView = new ControlView(this);

            callStackView  = new CallStackView(this);
            stackFrameView = new StackFrameView(this);

            //stackView = new StackView(this);
            //flagView = new FlagView(this);
            statusView      = new StatusView(this);
            symbolView      = new SymbolView(this);
            watchView       = new WatchView(this);
            breakPointView  = new BreakPointView(this);
            instructionView = new InstructionView(this);
            methodView      = new MethodView(this);

            //scriptView = new ScriptView(this);

            AppLocations.FindApplications();
        }
Ejemplo n.º 5
0
        public void IndicatorIntersect(Ray ray, WatchView view)
        {
            IndicatorGroup result = null;
            float?         closestIntersection = float.MaxValue;

            foreach (IndicatorGroup group in indicatorView[view])
            {
                var intersectionResult = group.Intersects(ray);
                if (intersectionResult != null && intersectionResult < closestIntersection)
                {
                    closestIntersection = intersectionResult;
                    result = group;
                }
            }
            if (result != null)
            {
                foreach (var group in indicatorView[view])
                {
                    if (group.active)
                    {
                        group.Inactive();
                    }
                }
                result.Active();
            }
        }
Ejemplo n.º 6
0
        // new vertex update method after implementing the indicator
        public void UpdateVertex(GestureSample gesture, WatchView view)
        {
            float scale = Scale(gesture);

            if (scale != 0)
            {
            }
        }
Ejemplo n.º 7
0
 public Dimension GetActiveIndicatorTarget(WatchView view)
 {
     foreach (IndicatorGroup group in indicatorView[view])
     {
         if (group.active)
         {
             return(group.Target);
         }
     }
     return(Dimension.None);
 }
Ejemplo n.º 8
0
 public void UpdateIndicator(WatchView view)
 {
     selected.InitIndicators();
     if (selected.Equals(case_))                // update case
     {
         if (view == WatchView.Front)
         {
             lug.InitIndicators();
         }
         else if (view == WatchView.Side)
         {
             bezel.InitIndicators();
         }
     }
 }
    public Task <ActionResult <WatchView> > AddWatch([FromRoute] long contentId)
    {
        return(MatchExceptions(async() =>
        {
            RateLimit(RateInteract);
            var uid = GetUserIdStrict();

            //Now construct the watch
            var watch = new WatchView()
            {
                contentId = contentId
            };

            await shortcuts.ClearNotificationsAsync(watch, uid);

            return await CachedWriter.WriteAsync(watch, uid); //message used for activity and such
        }));
    }
Ejemplo n.º 10
0
        public MainForm()
        {
            InitializeComponent();

            outputView = new OutputView(this);

            registersView = new RegisterView(this);

            displayView = new DisplayView(this);
            controlView = new ControlView(this);
            traceView   = new TraceView(this);

            callStackView  = new CallStackView(this);
            stackFrameView = new StackFrameView(this);

            statusView           = new StatusView(this);
            symbolView           = new SymbolView(this);
            watchView            = new WatchView(this);
            breakPointView       = new BreakpointView(this);
            instructionView      = new InstructionView(this);
            methodView           = new MethodView(this);
            methodParametersView = new MethodParametersView(this);

            //scriptView = new ScriptView(this);

            sourceView = new SourceView(this);

            sourceDataView = new SourceDataView(this);              // only useful when debugging this tool

            launchView = new LaunchView(this);

            Settings = AppLocationsSettings.GetAppLocations();

            Settings.SetValue("Emulator.GDB", true);
            Settings.SetValue("Emulator.Serial", "TCPServer");
            Settings.SetValue("Emulator.Serial.Port", 1250);
            Settings.SetValue("Emulator.Display", false);

            GDBPort = 1234;

            AppDomain.CurrentDomain.DomainUnload       += (s, e) => { KillVMProcess(); };
            AppDomain.CurrentDomain.ProcessExit        += (s, e) => { KillVMProcess(); };
            AppDomain.CurrentDomain.UnhandledException += (s, e) => { KillVMProcess(); };
        }
Ejemplo n.º 11
0
        public void TestWatchConvert()
        {
            var service = CreateService <WatchViewSource>();

            //Just some standard content view
            var view = new WatchView()
            {
                id                 = 99,
                contentId          = 5,
                userId             = 6,
                lastNotificationId = 89,
                createDate         = DateTime.Now
            };

            var temp  = service.FromView(view);
            var view2 = service.ToView(temp);

            Assert.Equal(view, view2);
        }
    public async Task ClearNotifications_Simple(long uid, long cid, bool allowed)
    {
        var watch = new WatchView()
        {
            contentId = cid
        };

        //Clearing the notifications is a simple lookup, it does NOT throw exceptions
        //when the content wasn't found.
        await service.ClearNotificationsAsync(watch, uid);

        if (allowed)
        {
            Assert.True(watch.lastActivityId > 0);
            Assert.True(watch.lastCommentId > 0);
        }
        else
        {
            Assert.Equal(0, watch.lastActivityId);
            Assert.Equal(0, watch.lastCommentId);
        }
    }
    public async Task LookupWatchByContentId_Simple(long uid, long cid)
    {
        //Shouldn't exist at first... we hope?
        await Assert.ThrowsAnyAsync <NotFoundException>(() => service.LookupWatchByContentIdAsync(uid, cid));

        var watch = new WatchView()
        {
            contentId = cid
        };
        await service.ClearNotificationsAsync(watch, uid);

        var writtenWatch = await writer.WriteAsync(watch, uid);

        Assert.Equal(watch.lastCommentId, writtenWatch.lastCommentId);
        Assert.Equal(watch.lastActivityId, writtenWatch.lastActivityId);

        //now go look it up
        var lookupWatch = await service.LookupWatchByContentIdAsync(uid, cid);

        Assert.Equal(uid, lookupWatch.userId);
        Assert.Equal(cid, lookupWatch.contentId);
        Assert.Equal(watch.lastCommentId, lookupWatch.lastCommentId);
        Assert.Equal(watch.lastActivityId, lookupWatch.lastActivityId);
    }
Ejemplo n.º 14
0
        public override void SetupCustomUIElements(Controls.dynNodeView nodeUI)
        {
            MenuItem mi = new MenuItem();
            mi.Header = "Zoom to Fit";
            mi.Click += new RoutedEventHandler(mi_Click);

            nodeUI.MainContextMenu.Items.Add(mi);

            //take out the left and right margins and make this so it's not so wide
            //NodeUI.inputGrid.Margin = new Thickness(10, 10, 10, 10);

            //add a 3D viewport to the input grid
            //http://helixtoolkit.codeplex.com/wikipage?title=HelixViewport3D&referringTitle=Documentation
            _watchView = new WatchView();
            _watchView.watch_view.DataContext = this;

            RenderOptions.SetEdgeMode(_watchView, EdgeMode.Unspecified);

            Points = new Point3DCollection();
            Lines = new Point3DCollection();

            _points = new PointsVisual3D { Color = Colors.Red, Size = 6 };
            _lines = new LinesVisual3D { Color = Colors.Blue, Thickness = 1 };

            _points.Points = Points;
            _lines.Points = Lines;

            _watchView.watch_view.Children.Add(_lines);
            _watchView.watch_view.Children.Add(_points);

            _watchView.watch_view.Children.Add(new DefaultLights());

            _watchView.Width = 400;
            _watchView.Height = 300;

            System.Windows.Shapes.Rectangle backgroundRect = new System.Windows.Shapes.Rectangle();
            backgroundRect.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            backgroundRect.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
            //backgroundRect.RadiusX = 10;
            //backgroundRect.RadiusY = 10;
            backgroundRect.IsHitTestVisible = false;
            BrushConverter bc = new BrushConverter();
            Brush strokeBrush = (Brush)bc.ConvertFrom("#313131");
            backgroundRect.Stroke = strokeBrush;
            backgroundRect.StrokeThickness = 1;
            SolidColorBrush backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb(250, 250, 216));
            backgroundRect.Fill = backgroundBrush;

            //nodeUI.inputGrid.Children.Add(backgroundRect);
            //nodeUI.inputGrid.Children.Add(_watchView);

            nodeUI.grid.Children.Add(backgroundRect);
            nodeUI.grid.Children.Add(_watchView);
            backgroundRect.SetValue(Grid.RowProperty,2);
            backgroundRect.SetValue(Grid.ColumnSpanProperty,3);
            _watchView.SetValue(Grid.RowProperty, 2);
            _watchView.SetValue(Grid.ColumnSpanProperty, 3);
            _watchView.Margin = new Thickness(5,0,5,5);
            backgroundRect.Margin = new Thickness(5, 0, 5, 5);
            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
        }
Ejemplo n.º 15
0
        public override void SetupCustomUIElements(object ui)
        {
            var nodeUI = ui as dynNodeView;

            MenuItem mi = new MenuItem();

            mi.Header = "Zoom to Fit";
            mi.Click += new RoutedEventHandler(mi_Click);

            nodeUI.MainContextMenu.Items.Add(mi);

            //take out the left and right margins and make this so it's not so wide
            //NodeUI.inputGrid.Margin = new Thickness(10, 10, 10, 10);

            //add a 3D viewport to the input grid
            //http://helixtoolkit.codeplex.com/wikipage?title=HelixViewport3D&referringTitle=Documentation
            _watchView = new WatchView();
            _watchView.watch_view.DataContext = this;

            RenderOptions.SetEdgeMode(_watchView, EdgeMode.Unspecified);

            Points = new Point3DCollection();
            Lines  = new Point3DCollection();

            _points = new PointsVisual3D {
                Color = Colors.Red, Size = 6
            };
            _lines = new LinesVisual3D {
                Color = Colors.Blue, Thickness = 1
            };

            _points.Points = Points;
            _lines.Points  = Lines;

            _watchView.watch_view.Children.Add(_lines);
            _watchView.watch_view.Children.Add(_points);

            _watchView.watch_view.Children.Add(new DefaultLights());

            _watchView.Width  = 400;
            _watchView.Height = 300;

            System.Windows.Shapes.Rectangle backgroundRect = new System.Windows.Shapes.Rectangle();
            backgroundRect.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            backgroundRect.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            //backgroundRect.RadiusX = 10;
            //backgroundRect.RadiusY = 10;
            backgroundRect.IsHitTestVisible = false;
            BrushConverter bc          = new BrushConverter();
            Brush          strokeBrush = (Brush)bc.ConvertFrom("#313131");

            backgroundRect.Stroke          = strokeBrush;
            backgroundRect.StrokeThickness = 1;
            SolidColorBrush backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb(250, 250, 216));

            backgroundRect.Fill = backgroundBrush;

            nodeUI.grid.Children.Add(backgroundRect);
            nodeUI.grid.Children.Add(_watchView);
            backgroundRect.SetValue(Grid.RowProperty, 2);
            backgroundRect.SetValue(Grid.ColumnSpanProperty, 3);
            _watchView.SetValue(Grid.RowProperty, 2);
            _watchView.SetValue(Grid.ColumnSpanProperty, 3);
            _watchView.Margin            = new Thickness(5, 0, 5, 5);
            backgroundRect.Margin        = new Thickness(5, 0, 5, 5);
            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
        }
Ejemplo n.º 16
0
 public void DrawIndicator(Effect effect, WatchView view)
 {
     selected.DrawIndicator(effect, view);
 }
Ejemplo n.º 17
0
        // vertex update method
        public void UpdateVertex(GameTime gameTime, GestureSample gesture, WatchView view)
        {
            float scale = Scale(gesture);

            if (scale != 0)
            {
                if (selected.Equals(case_))                    // update case
                {
                    if (view == WatchView.Front)
                    {
                        Dimension target = case_.GetActiveIndicatorTarget(view);
                        switch (target)
                        {
                        case Dimension.OuterRadius:
                            case_.UpdateOuterRadius(scale);
                            lug.UpdateCaseRadius(scale);
                            break;

                        case Dimension.Vertical:
                            break;

                        case Dimension.Horizontal:
                            break;

                        default:
                            break;
                        }
                    }
                    else if (view == WatchView.Side)
                    {
                        case_.UpdateHeight(scale);
                        bezel.UpdateCaseHeight(scale);
                        bottom.UpdateCaseHeight(scale);
                    }
                }
                else if (selected.Equals(bezel))                      // update bezel
                {
                    if (view == WatchView.Front)
                    {
                        Dimension target = case_.GetActiveIndicatorTarget(view);
                        switch (target)
                        {
                        case Dimension.OuterRadius:
                            bezel.UpdateOuterRadius(scale);
                            break;

                        case Dimension.Vertical:
                            break;

                        case Dimension.Horizontal:
                            break;

                        default:
                            break;
                        }
                    }
                    else if (view == WatchView.Side)
                    {
                        bezel.UpdateHeight(scale);
                    }
                }
                else if (selected.Equals(lug))                      // update lug
                {
                    if (view == WatchView.Front)
                    {
//						float HalfScreenHeight = device.Viewport.Height / 2;
//						if (gesture.Position.Y <= HalfScreenHeight && gesture.Position2.Y <= HalfScreenHeight) {
//							lug.UpdateTopWidth (scale);
//						} else {
//							lug.UpdateBottomWidth (scale);
//						}
                        Dimension target = lug.GetActiveIndicatorTarget(view);
                        switch (target)
                        {
                        case Dimension.TopWidth:
                            lug.UpdateTopWidth(scale);
                            break;

                        case Dimension.BottomWidth:
                            lug.UpdateBottomWidth(scale);
                            break;

                        default:
                            break;
                        }
                    }
                    else if (view == WatchView.Side)
                    {
                        Dimension target = lug.GetActiveIndicatorTarget(view);
                        switch (target)
                        {
                        case Dimension.Height:
                            lug.UpdateHeight(scale);
                            break;

                        case Dimension.SideWidth:
                            lug.UpdateSideWidth(scale);
                            break;

                        default:
                            break;
                        }
                    }
                }
                else if (selected.Equals(bottom))                      // update bottom
                {
                    if (view == WatchView.Front)
                    {
                    }
                }
            }
        }
        private static void RenderRowData(System.Windows.Forms.DataGridViewRow row, uint groupSize, WatchView data, uint binHexSeparator, uint intSeparator, bool leadingZeroes)
        {
            var variableType = VariableTypeUtils.TypeFromShortName(row.HeaderCell.Value.ToString());

            for (int i = 0; i < groupSize; i++)
            {
                row.Cells[i + VisualizerTable.DataColumnOffset].Value = DataFormatter.FormatDword(variableType, data[i],
                                                                                                  binHexSeparator, intSeparator, leadingZeroes);
            }
        }
Ejemplo n.º 19
0
 public Task <ActionResult <WatchView> > WriteWatchAsync([FromBody] WatchView watch) =>
 MatchExceptions(() => WriteAsync(watch));
Ejemplo n.º 20
0
 public void SwitchIndicator(Ray ray, WatchView view)
 {
     selected.IndicatorIntersect(ray, view);
 }