Exemple #1
0
        void IView.SetViewModel(IViewModel viewModel)
        {
            this.viewModel = viewModel;

            res = new GraphicsResources(
                viewModel,
                Font.FontFamily.Name,
                Font.Size,
                8f,
                6f,
                new LJD.Image(TimelineVisualizerControlResources.UserAction),
                new LJD.Image(TimelineVisualizerControlResources.APICall),
                new LJD.Image(TimelineVisualizerControlResources.TimelineBookmark),
                new LJD.Image(TimelineVisualizerControlResources.FocusedMsgSlaveVert),
                UIUtils.Dpi.ScaleUp(1, 120),
                new LJD.Brush(System.Drawing.SystemColors.Control.ToColor())
                );
            drawing = new ControlDrawing(res);
            var vm = GetUpToDateViewMetrics();

            var rulersPanelHeight = vm.RulersPanelHeight;

            activitiesScrollBar.SmallChange = vm.LineHeight;
            activitiesScrollBar.Top         = rulersPanelHeight;
            quickSearchEditBox.Top          = rulersPanelHeight - quickSearchEditBox.Height;
            panel5.Height = rulersPanelHeight;

            this.changeNotification = viewModel.ChangeNotification;
            var updateNotificationsButton = Updaters.Create(() => viewModel.NotificationsIconVisibile, v => notificationsButton.Visible = v);
            var updateNoContentMessage    = Updaters.Create(() => viewModel.NoContentMessageVisibile, SetNoContentMessageVisibility);
            var updateVertScroller        = Updaters.Create(
                Selectors.Create(() => viewModel.ActivitiesCount, () => activitiesViewPanelSize, (activitiesCount, sz) => new { activitiesCount, sz }),
                key => UpdateActivitiesScroller(key.activitiesCount, key.sz.Value));
            var updateCurrentActivityInfo = Updaters.Create(() => viewModel.CurrentActivity, UpdateCurrentActivityControls);

            this.changeNotificationSubscription = changeNotification.CreateSubscription(() => {
                updateNotificationsButton();
                updateNoContentMessage();
                updateVertScroller();
                updateCurrentActivityInfo();
            });
            this.ParentForm.VisibleChanged += (s, e) =>
            {
                if (this.ParentForm.Visible)
                {
                    viewModel.OnWindowShown();
                }
                else
                {
                    viewModel.OnWindowHidden();
                }
            };
        }
 public ViewMetrics(GraphicsResources res)
 {
     this.res = res;
 }
 public ControlDrawing(GraphicsResources res)
 {
     this.res = res;
 }