/// <summary>
        /// Calculate a rectangle in control coodinates that is aligned for gradient drawing.
        /// </summary>
        /// <param name="align">How to align the gradient.</param>
        /// <param name="local">Rectangle of the local element.</param>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        /// <returns></returns>
        public Rectangle GetAlignedRectangle(PaletteRectangleAlign align, Rectangle local)
        {
            switch (align)
            {
            case PaletteRectangleAlign.Local:
                // Gradient should cover just the local view element itself
                local.Inflate(2, 2);
                return(local);

            case PaletteRectangleAlign.Control:
                Rectangle clientRect = (AlignControl == Control)
                        ? Control.ClientRectangle
                        : Control.RectangleToClient(AlignControl.RectangleToScreen(AlignControl.ClientRectangle));

                clientRect.Inflate(2, 2);
                return(clientRect);

            case PaletteRectangleAlign.Form:
                // Gradient should cover the owning control (most likely a Form)
                Rectangle formRect = Control.RectangleToClient(TopControl.RectangleToScreen(AlignControl.ClientRectangle));
                formRect.Inflate(2, 2);
                return(formRect);

            case PaletteRectangleAlign.Inherit:
            default:
                // Should never call this routine with inherit value
                Debug.Assert(false);
                throw new ArgumentOutOfRangeException(nameof(align));
            }
        }
Ejemplo n.º 2
0
 private void SetOnClick(DateTime date, TopControl control)
 {
     if (!string.IsNullOrEmpty(control.OnClick))
     {
         control.OnClick = control.OnClick.Replace("Month", date.Month.ToString());
         control.OnClick = control.OnClick.Replace("Year", date.Year.ToString());
     }
 }
Ejemplo n.º 3
0
 private void SetHref(DateTime date, TopControl control)
 {
     if (!string.IsNullOrEmpty(control.Href))
     {
         control.Href = control.Href.Replace("Month", date.Month.ToString());
         control.Href = control.Href.Replace("Year", date.Year.ToString());
     }
 }
Ejemplo n.º 4
0
 private void SetValues(DateTime date, TopControl control)
 {
     if (!string.IsNullOrEmpty(control.Value))
     {
         control.Value = control.Value.Replace("MonthName", Utils.GetMonthName(date.Month));
         control.Value = control.Value.Replace("Year", date.Year.ToString());
     }
 }
Ejemplo n.º 5
0
        protected override void ToggleButtons()
        {
            var topPosition = PointToClient(TopControl.PointToScreen(Point.Empty));

            _btnScrollUp.Visible = (GetVerticalScrollPosition() > 1);

            BottomControl = BottomPredicateCheck() ? (Control)progressBar : panelResultsLabel;
            var bottomPosition = PointToClient(BottomControl.PointToScreen(Point.Empty));

            _btnScrollDown.Visible = (bottomPosition.Y + BottomControl.Height) > this.ClientSize.Height;
        }
Ejemplo n.º 6
0
        public async void LoadTopData()
        {
            mw.OpenLoading();
            var dt = await mw.ml.GetTopIndexAsync();

            topIndexList.Visibility = Visibility.Hidden;
            topIndexList.Children.Clear();
            foreach (var d in dt)
            {
                var top = new TopControl(d);
                top.MouseDown += mw.Top_MouseDown;
                top.Margin     = new Thickness(12, 0, 12, 20);
                topIndexList.Children.Add(top);
            }
            mw.WidthUI(topIndexList);
            await Task.Delay(50);

            mw.CloseLoading();
            topIndexList.Visibility = Visibility.Visible;
            mw.RunAnimation(topIndexList);
        }
Ejemplo n.º 7
0
        private void SetValues(TopControl control, bool add)
        {
            int linkValue = this._weekNo;

            if (add)
            {
                linkValue++;
            }
            else
            {
                linkValue--;
            }

            if (!string.IsNullOrEmpty(control.Href))
            {
                control.Href = control.Href.Replace("WeekNo", linkValue.ToString());
            }

            if (!string.IsNullOrEmpty(control.OnClick))
            {
                control.OnClick = control.OnClick.Replace("WeekNo", linkValue.ToString());
            }
        }
 public MainWindowViewModel()
 {
     MiddleDataControl = new LoginControl();
     TopDataControl    = new TopControl();
 }