void ShowDriverInfo(DeviceInfo device)
        {
            Window mainWnd = Application.Current.MainWindow;
            DriverDetailInfoPopup driverInfoDetailPopup = new DriverDetailInfoPopup { Owner = mainWnd };

            driverInfoDetailPopup.DriverName.Text = device.DeviceName;
            if (!string.IsNullOrEmpty(device.InstalledDriverDate))
                driverInfoDetailPopup.DetailCurrentDriverDate.Text = device.InstalledDriverDate.ToString();
            if (!string.IsNullOrEmpty(device.NewDriverDate))
                driverInfoDetailPopup.DetailNewDriverDate.Text = device.NewDriverDate.ToString();

            driverInfoDetailPopup.Left = mainWnd.Left + (mainWnd.Width / 2 - driverInfoDetailPopup.Width / 2);
            int regToolsHeight = (int)driverInfoDetailPopup.Height;
            driverInfoDetailPopup.Height = 0;
            int topStart = (int)(mainWnd.Top + mainWnd.Height) + 30;
            driverInfoDetailPopup.Top = topStart;
            int topFinal = (int)(mainWnd.Top + (mainWnd.Height / 2 - regToolsHeight / 2));

            const int fullAnimationDuration = 50;
            int heightAnimationDuration = (fullAnimationDuration * regToolsHeight / (topStart - topFinal));

            DoubleAnimation slideUp = new DoubleAnimation
             {
                 From = topStart,
                 To = topFinal,
                 Duration = new Duration(TimeSpan.FromMilliseconds(fullAnimationDuration))
             };

            driverInfoDetailPopup.BeginAnimation(Window.TopProperty, slideUp);

            DoubleAnimation scaleUp = new DoubleAnimation
            {
                From = 0,
                To = regToolsHeight,
                Duration = new Duration(TimeSpan.FromMilliseconds(heightAnimationDuration))
            };
            driverInfoDetailPopup.BeginAnimation(Window.HeightProperty, scaleUp);

            driverInfoDetailPopup.AnimateInnerBox();

            driverInfoDetailPopup.ShowDialog();
        }
예제 #2
0
        void ShowDriverInfo(object id)
        {
            Window mainWnd = Application.Current.MainWindow;
            DriverDetailInfoPopup driverInfoDetailPopup = new DriverDetailInfoPopup { Owner = mainWnd };


            DeviceInfo device = AllDevices.FirstOrDefault(d => d.Id == (string)id);
            if (device != null)
            {
                driverInfoDetailPopup.DriverName.Text = device.DeviceName;
                driverInfoDetailPopup.DetailCurrentDriverDate.Text = device.InstalledDriverDate.ToString();
                driverInfoDetailPopup.DetailNewDriverDate.Text = device.NewDriverDate.ToString();
            }

            driverInfoDetailPopup.Left = mainWnd.Left + (mainWnd.Width / 2 - driverInfoDetailPopup.Width / 2);
            var regToolsHeight = (int)driverInfoDetailPopup.Height;
            driverInfoDetailPopup.Height = 0;
            int topStart = (int)(mainWnd.Top + mainWnd.Height) + 30;
            driverInfoDetailPopup.Top = topStart;
            var topFinal = (int)(mainWnd.Top + (mainWnd.Height / 2 - regToolsHeight / 2));

            const int fullAnimationDuration = 300;
            int heightAnimationDuration = (fullAnimationDuration * regToolsHeight / (topStart - topFinal));

            var slideUp = new DoubleAnimation
             {
                 From = topStart,
                 To = topFinal,
                 Duration = new Duration(TimeSpan.FromMilliseconds(fullAnimationDuration))
             };
            driverInfoDetailPopup.BeginAnimation(Window.TopProperty, slideUp);

            var scaleUp = new DoubleAnimation
            {
                From = 0,
                To = regToolsHeight,
                Duration = new Duration(TimeSpan.FromMilliseconds(heightAnimationDuration))
            };
            driverInfoDetailPopup.BeginAnimation(Window.HeightProperty, scaleUp);

            driverInfoDetailPopup.AnimateInnerBox();

            driverInfoDetailPopup.ShowDialog();
        }