예제 #1
0
        /*******************************************************************************
        *       AddButton()
        *******************************************************************************/
        /// <summary>
        /// Adds a demo button. Note that the <see cref="FrameworkElement.Tag"/> property
        /// is used to keep track of the <paramref name="demoId"/>.
        /// </summary>
        /// <param name="demoId">The demonstration to associate with the button.</param>
        void AddDemoButton(DemoId demoId, Brush background)
        {
            // Create a demo button
            var button = new Button()
            {
                Margin          = new Thickness(new Length(5, Unit.Px)),
                BorderThickness = new Thickness(new Length(1, Unit.Px)),
                Background      = background,
                BorderBrush     = Common.GetSolidColorBrush(Colors.SlateBlue),
                CornerRadius    = new CornerRadius(new Length(0, Unit.Px), NormalButtonCornerRadius, NormalButtonCornerRadius, new Length(12, Unit.Px)),
                Padding         = new Thickness(new Length(4, Unit.Px)),
                Tag             = demoId,
                Child           = new TextBlock()       // Use a TextBlock as the button's child.
                {
                    Text                = demoId.ToString(),
                    Foreground          = Common.GetSolidColorBrush(Colors.White),
                    HorizontalAlignment = HorizontalAlignment.Center,
                    IsHitTestVisible    = false,
                }
            };

            // Handle the Click event
            button.Click += DemoButton_Click;

            // Finally, add the button to the list of buttons
            e_buttons.Children.Add(button);
        }
 public override Task <DemoRequest> GetById(DemoId request, ServerCallContext context)
 {
     return(Task.FromResult(new DemoRequest()
     {
         CommentId = request.Id,
         Id = DateTime.Now.Ticks.ToString(),
         IsDeleted = false
     }));
 }
예제 #3
0
        private static void RunDemo(DemoId demoId)
        {
            Console.WriteLine("\nRESULTS ({0}):\n", demoId);

            var sw = Stopwatch.StartNew();

            var masterData = GetMasterData(c_count);
            var detailData = GetDetailData(c_count);

            var outerData = GetMasterData(c_count).Where(x => x.MasterId != c_skipCount + 2);
            var innerData = GetMasterData(c_count).Where(x => x.MasterId != c_skipCount + 3);

            switch (demoId)
            {
            case DemoId.StandardGroupJoin:
                masterData.GroupJoin(detailData, m => m.MasterId, d => d.MasterId, Tuple.Create)
                .Skip(c_skipCount).Take(c_takeCount).PrintData();
                break;

            case DemoId.OrderedEqualityGroupJoin:
                masterData.OrderedEqualityGroupJoin(detailData, m => m.MasterId, d => d.MasterId, Tuple.Create)
                .Skip(c_skipCount).Take(c_takeCount).PrintData();
                break;

            case DemoId.OrderedCompareGroupJoin:
                masterData.OrderedCompareGroupJoin(detailData, m => m.MasterId, d => d.MasterId, Tuple.Create)
                .Skip(c_skipCount).Take(c_takeCount).PrintData();
                break;

            case DemoId.StandardJoin:
                outerData.Join(innerData, x => x.MasterId, x => x.MasterId, Tuple.Create)
                .Skip(c_skipCount).Take(c_takeCount).PrintData();
                break;

            case DemoId.OrderedInnerJoin:
                outerData.OrderedInnerJoin(innerData, x => x.MasterId, x => x.MasterId, Tuple.Create)
                .Skip(c_skipCount).Take(c_takeCount).PrintData();
                break;

            case DemoId.OrderedFullJoin:
                outerData.OrderedFullJoin(innerData, x => x.MasterId, x => x.MasterId, Tuple.Create)
                .Skip(c_skipCount).Take(c_takeCount).PrintData();
                break;

            case DemoId.OrderedLeftJoin:
                outerData.OrderedLeftJoin(innerData, x => x.MasterId, x => x.MasterId, Tuple.Create)
                .Skip(c_skipCount).Take(c_takeCount).PrintData();
                break;

            case DemoId.OrderedRightJoin:
                outerData.OrderedRightJoin(innerData, x => x.MasterId, x => x.MasterId, Tuple.Create)
                .Skip(c_skipCount).Take(c_takeCount).PrintData();
                break;
            }

            Console.WriteLine("\nElapsed (ms): {0}", sw.ElapsedMilliseconds);
        }
예제 #4
0
        /*******************************************************************************
        *       ShowDemo()
        *******************************************************************************/
        /// <summary>
        /// Shows the requested demo. If <paramref name="newDemo"/> is null then the
        /// app returns to the home state.
        /// </summary>
        /// <param name="newDemo"></param>
        void ShowDemo(DemoId demoId, UIElement newDemo)
        {
            if (null != currentDemo)
            {
                e_scollViewer.Child = null;
            }

            if (null != newDemo)
            {
                e_scollViewer.Child = newDemo;
            }

            currentDemoId = demoId;
            currentDemo   = newDemo;
        }
 public DemoRequest GetById(DemoId request)
 {
     return(this.Client.GetById(request));
 }