コード例 #1
0
        private void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "ADDRESS_COUNTRY_INVALID":
                VisualUtilities.ShakeView(FieldCountry);
                break;

            case "ADDRESS_CITY_INVALID":
                VisualUtilities.ShakeView(FieldCity);
                break;

            case "ADDRESS_POSTCODE_INVALID":
                VisualUtilities.ShakeView(FieldPostcode);
                break;

            case "ADDRESS_STATE_INVALID":
                VisualUtilities.ShakeView(FieldState);
                break;

            case "ADDRESS_STREET_LINE1_INVALID":
                VisualUtilities.ShakeView(FieldStreet1);
                break;

            case "ADDRESS_STREET_LINE2_INVALID":
                VisualUtilities.ShakeView(FieldStreet2);
                break;
            }
        }
コード例 #2
0
        private void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "CARD_NUMBER_INVALID":
                VisualUtilities.ShakeView(FieldCard);
                break;

            case "CARD_EXPIRE_DATE_INVALID":
                VisualUtilities.ShakeView(FieldDate);
                break;

            case "CARD_HOLDER_NAME_INVALID":
                VisualUtilities.ShakeView(FieldCardName);
                break;

            case "CARD_CVC_INVALID":
                VisualUtilities.ShakeView(FieldCVC);
                break;

            case "CARD_COUNTRY_INVALID":
                VisualUtilities.ShakeView(FieldCountry);
                break;

            case "CARD_ZIP_INVALID":
                VisualUtilities.ShakeView(FieldPostcode);
                break;
            }

            if (e.PropertyName.Equals("Navigate"))
            {
                View.Navigate(new Uri(ViewModel.PaymentForm.Url));
            }
        }
コード例 #3
0
        internal override void OnUpdateView(DataPoint dataPoint)
        {
            base.OnUpdateView(dataPoint);
            DataPointView view = dataPoint.View;

            if (view == null || view.MarkerView == null)
            {
                return;
            }
            double        markerSize    = this.GetMarkerSize(dataPoint);
            MarkerControl markerControl = view.MarkerView as MarkerControl;

            if (markerControl != null)
            {
                markerControl.Width  = markerSize;
                markerControl.Height = markerSize;
            }
            Path path = view.MarkerView as Path;

            if (path != null)
            {
                path.Width  = markerSize;
                path.Height = markerSize;
                path.Data   = VisualUtilities.GetMarkerGeometry(dataPoint.MarkerType, new Size(markerSize, markerSize));
            }
            this.SeriesPresenter.UpdateDataPointZIndex(dataPoint);
            dataPoint.UpdateActualLabelMargin(markerSize);
            ((AnchorPanel)this.MarkersPanel).Invalidate();
        }
コード例 #4
0
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if (sender is CheckBox check && check.DataContext is LineViewData line && check.Tag is BaseChartView chartView)
            {
                var lines = chartView.GetLines();
                if (line.enabled && lines.Except(new[] { line }).Any(x => x.enabled))
                {
                    line.enabled    = false;
                    check.IsChecked = false;

                    chartView.onCheckChanged();
                }
                else if (!line.enabled)
                {
                    line.enabled    = true;
                    check.IsChecked = true;

                    chartView.onCheckChanged();
                }
                else
                {
                    VisualUtilities.ShakeView(check);
                }

                //var border =

                //test.onCheckChanged();
            }
        }
コード例 #5
0
ファイル: PolylineControl.cs プロジェクト: sulerzh/chart
 private void InitilizePolylineSegment(Polyline polyline, PolylineSegmentDefinition segment)
 {
     if (segment.Points.Count == 1)
     {
         polyline.Points = new PointCollection()
         {
             segment.Points[0],
             segment.Points[0]
         };
         polyline.StrokeStartLineCap = PenLineCap.Round;
         polyline.StrokeEndLineCap   = PenLineCap.Round;
         polyline.StrokeThickness    = segment.Appearance.StrokeThickness * 2.0;
     }
     else
     {
         polyline.Points             = segment.Points;
         polyline.StrokeStartLineCap = PenLineCap.Flat;
         polyline.StrokeEndLineCap   = PenLineCap.Flat;
         polyline.StrokeThickness    = segment.Appearance.StrokeThickness;
     }
     polyline.Stroke          = segment.Appearance.Stroke;
     polyline.StrokeDashArray = VisualUtilities.GetStrokeDashArray(segment.Appearance.StrokeDashType);
     polyline.Effect          = segment.Appearance.Effect;
     polyline.Opacity         = segment.Appearance.Opacity;
 }
コード例 #6
0
 private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
 {
     if (Date.Date == null)
     {
         VisualUtilities.ShakeView(Date);
         args.Cancel = true;
     }
 }
コード例 #7
0
 private void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     switch (e.PropertyName)
     {
     case "PASSWORD_INVALID":
         VisualUtilities.ShakeView(PrimaryInput);
         break;
     }
 }
コード例 #8
0
        private void AddButtonClick(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(PassText.Password))
            {
                PassText.Focus(FocusState.Keyboard);
                VisualUtilities.ShakeView(PassText);

                return;
            }
            else if (string.IsNullOrEmpty(RePassText.Password))
            {
                RePassText.Focus(FocusState.Keyboard);
                VisualUtilities.ShakeView(RePassText);
                return;
            }
            if (PassText.Password.Length == 4)
            {
                if (PassText.Password.All(x => x >= '0' && x <= '9') && Helper.Passcode.Check(PassText.Password))
                {
                }
                else
                {
                    PassText.Focus(FocusState.Keyboard);
                    VisualUtilities.ShakeView(PassText);
                    Helper.ShowNotify("Enter 4-digits numbers");
                    return;
                }
            }
            if (RePassText.Password.Length == 4)
            {
                if (RePassText.Password.All(x => x >= '0' && x <= '9') && Helper.Passcode.Check(RePassText.Password))
                {
                }
                else
                {
                    RePassText.Focus(FocusState.Keyboard);
                    VisualUtilities.ShakeView(RePassText);
                    Helper.ShowNotify("Enter 4-digits numbers");
                    return;
                }
            }
            {
                if (PassText.Password == RePassText.Password)
                {
                    Helper.Passcode.Set(PassText.Password);

                    Hide();
                }
                else
                {
                    VisualUtilities.ShakeView(RePassText);

                    RePassText.Focus(FocusState.Keyboard);
                }
            }
        }
コード例 #9
0
        private void Lock()
        {
            if (_passcodeService.RetryIn > 0)
            {
                _retryTimer.Start();
            }

            VisualUtilities.ShakeView(Field);
            Field.Password = string.Empty;
        }
コード例 #10
0
        private static void CallDefWindowProcWithoutVisibleStyle(IntPtr hwnd, ref bool handled)
        {
            var flag = VisualUtilities.ModifyStyle(hwnd, 268435456, 0);

            if (flag)
            {
                VisualUtilities.ModifyStyle(hwnd, 0, 268435456);
            }
            handled = true;
        }
コード例 #11
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            //if (/*Confirm.Password.Length != 4 || !Confirm.Password.All(x => x >= '0' && x <= '9') ||*/ !_passcodeService.Check(Confirm.Password))
            if (await _verify(Confirm.Password))
            {
                VisualUtilities.ShakeView(Confirm);
                Confirm.Password = string.Empty;
                args.Cancel      = true;
            }

            Passcode = Confirm.Password.ToString();
        }
コード例 #12
0
 private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
 {
     if (Date.Date == null || Date.Date < DateTime.Today)
     {
         VisualUtilities.ShakeView(Date);
         args.Cancel = true;
     }
     else if (Date.Date == DateTime.Today && Time.Time <= DateTime.Now.TimeOfDay)
     {
         VisualUtilities.ShakeView(Time);
         args.Cancel = true;
     }
 }
コード例 #13
0
        private void OnViewSizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (Messages.ScrollingHost.ScrollableHeight > 0)
            {
                return;
            }

            //Arrow.Visibility = Visibility.Collapsed;
            VisualUtilities.SetIsVisible(Arrow, false);

            ViewVisibleMessages(false);
            UpdateHeaderDate(false);
        }
コード例 #14
0
        private void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "FILES_INVALID":
                VisualUtilities.ShakeView(FilesButton);
                break;

            case "TRANSLATION_INVALID":
                VisualUtilities.ShakeView(TranslationButton);
                break;
            }
        }
コード例 #15
0
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            if (string.IsNullOrEmpty(Text))
            {
                VisualUtilities.ShakeView(TextField);
                args.Cancel = true;
                return;
            }

            if (IsUrlInvalid(Link))
            {
                VisualUtilities.ShakeView(LinkField);
                args.Cancel = true;
            }
        }
コード例 #16
0
ファイル: TestFixture.cs プロジェクト: vperevalov/WPFA
        public void ClickOn1IsDisplayedInResultsBox()
        {
            // Given
            Window mainWindow = Application.Current.MainWindow;
            Button b1         = VisualUtilities.FindByAutomationId <Button>(mainWindow, "B1_automation_id");

            // When
            VisualUtilities.Click(b1);
            VisualUtilities.Wait(TimeSpan.FromSeconds(1));

            // Then
            MyTextBox resultsBox = VisualUtilities.FindByName <MyTextBox>(mainWindow, "DisplayBox");

            Assert.AreEqual(resultsBox.Text, "1");
        }
コード例 #17
0
ファイル: PasscodeView.xaml.cs プロジェクト: xuan2261/Minista
 private void PassTextPasswordChanged(object sender, RoutedEventArgs e)
 {
     if (PassText.Password.Length == 4)
     {
         if (PassText.Password.All(x => x >= '0' && x <= '9') && Helper.Passcode.Check(PassText.Password))
         {
             Unlock();
         }
         else
         {
             VisualUtilities.ShakeView(PassText);
             PassText.Password = string.Empty;
         }
     }
 }
コード例 #18
0
        private void OnViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
        {
            if (Messages.ScrollingHost.ScrollableHeight - Messages.ScrollingHost.VerticalOffset < 120 && ViewModel.IsFirstSliceLoaded != false)
            {
                //Arrow.Visibility = Visibility.Collapsed;
                VisualUtilities.SetIsVisible(Arrow, false);
            }
            else
            {
                //Arrow.Visibility = Visibility.Visible;
                VisualUtilities.SetIsVisible(Arrow, true);
            }

            ViewVisibleMessages(e.IsIntermediate);
            UpdateHeaderDate(e.IsIntermediate);
        }
コード例 #19
0
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            var service = UnigramContainer.Current.ResolveType <IPasscodeService>();

            if (service == null)
            {
                return;
            }

            if (Confirm.Password.Length != 4 || !Confirm.Password.All(x => x >= '0' && x <= '9') || !service.Check(Confirm.Password))
            {
                VisualUtilities.ShakeView(Confirm);
                Confirm.Password = string.Empty;
                args.Cancel      = true;
            }
        }
コード例 #20
0
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            if (First.Password.Length != 4 || !First.Password.All(x => x >= '0' && x <= '9'))
            {
                VisualUtilities.ShakeView(First);
                args.Cancel = true;
                return;
            }

            if (!First.Password.Equals(Confirm.Password))
            {
                VisualUtilities.ShakeView(Confirm);
                args.Cancel = true;
                return;
            }

            Passcode = First.Password.ToString();
        }
コード例 #21
0
ファイル: ProxyView.xaml.cs プロジェクト: nazzi88ua/Unigram
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            if (IsProxyEnabled)
            {
                if (string.IsNullOrEmpty(FieldServer.Text) /* || !IPAddress.TryParse(Server, out IPAddress server)*/)
                {
                    VisualUtilities.ShakeView(FieldServer);
                    args.Cancel = true;
                    return;
                }

                if (string.IsNullOrEmpty(FieldPort.Text) || !int.TryParse(FieldPort.Text, out int port))
                {
                    VisualUtilities.ShakeView(FieldPort);
                    args.Cancel = true;
                    return;
                }
            }
        }
コード例 #22
0
 private void PassTextPasswordChanged(object sender, RoutedEventArgs e)
 {
     try
     {
         if (PassText.Password.Length == 4)
         {
             if (PassText.Password.All(x => x >= '0' && x <= '9') && Helper.Passcode.Check(PassText.Password))
             {
                 RePassText.Focus(FocusState.Keyboard);
             }
             else
             {
                 VisualUtilities.ShakeView(PassText);
                 Helper.ShowNotify("Enter 4-digits numbers");
             }
         }
     }
     catch { }
 }
コード例 #23
0
 private void RePassTextPasswordChanged(object sender, RoutedEventArgs e)
 {
     try
     {
         if (RePassText.Password.Length == 4)
         {
             if (RePassText.Password.All(x => x >= '0' && x <= '9') && Helper.Passcode.Check(PassText.Password))
             {
                 AddButtonClick(null, null);
             }
             else
             {
                 VisualUtilities.ShakeView(RePassText);
                 Helper.ShowNotify("Enter 4-digits numbers");
             }
         }
     }
     catch { }
 }
コード例 #24
0
        private void CustomizeDialog_Loaded(object sender, RoutedEventArgs e)
        {
            var button = VisualUtilities.FindChild <System.Windows.Controls.Button>(this, "Button");

            if (button == null)
            {
                return;
            }
            button.Click += OnCloseButtonClick;

            var toolBarsPage = VisualUtilities.FindChild <ToolBarsPage>(this, "ToolBarsPage");

            var m = toolBarsPage?.DataContext as ToolBarCustomizeDialogViewModel;

            if (m != null)
            {
                m.ToolBarHostViewModel = _toolBarHostViewModel;
            }
        }
コード例 #25
0
ファイル: ChartCell.xaml.cs プロジェクト: UnigramDev/Unigram
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            if (sender is CheckBox check && check.DataContext is LineViewData line)
            {
                var lines = chartView.GetLines();
                if (line.enabled && lines.Except(new[] { line }).Any(x => x.enabled))
                {
                    line.enabled    = false;
                    check.IsChecked = false;

                    chartView.OnCheckChanged();
                }
                else if (!line.enabled)
                {
                    line.enabled    = true;
                    check.IsChecked = true;

                    chartView.OnCheckChanged();
                }
                else
                {
                    VisualUtilities.ShakeView(check);
                    return;
                }

                if (data.activeZoom > 0 && zoomedChartView != null)
                {
                    var zoomedLines = zoomedChartView.GetLines();

                    var position = lines.IndexOf(line);
                    if (position < zoomedLines.Count)
                    {
                        zoomedLines[position].enabled = line.enabled;
                        zoomedChartView.OnCheckChanged();
                    }
                }

                //var border =

                //test.onCheckChanged();
            }
        }
コード例 #26
0
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            if (string.IsNullOrWhiteSpace(Text))
            {
                VisualUtilities.ShakeView(TextField);
                args.Cancel = true;
                return;
            }

            if (!Link.TrimStart().StartsWith("http"))
            {
                Link = "https://" + Link.TrimStart();
            }

            if (IsUrlInvalid(Link))
            {
                VisualUtilities.ShakeView(LinkField);
                args.Cancel = true;
            }
        }
コード例 #27
0
        protected static void ShowWindowMenu(HwndSource source, Point screenPoint, bool canMinimize)
        {
            var systemMetrics   = NativeMethods.GetSystemMetrics(40);
            var systemMenu      = NativeMethods.GetSystemMenu(source.Handle, false);
            var windowPlacement = NativeMethods.GetWindowPlacement(source.Handle);
            var flag            = VisualUtilities.ModifyStyle(source.Handle, 268435456, 0);
            var uEnable         = canMinimize ? 0U : 1U;

            if (windowPlacement.showCmd == 1)
            {
                NativeMethods.EnableMenuItem(systemMenu, 61728U, 1U);
                NativeMethods.EnableMenuItem(systemMenu, 61456U, 0U);
                NativeMethods.EnableMenuItem(systemMenu, 61440U, 0U);
                NativeMethods.EnableMenuItem(systemMenu, 61488U, 0U);
                NativeMethods.EnableMenuItem(systemMenu, 61472U, uEnable);
                NativeMethods.EnableMenuItem(systemMenu, 61536U, 0U);
            }
            else if (windowPlacement.showCmd == 3)
            {
                NativeMethods.EnableMenuItem(systemMenu, 61728U, 0U);
                NativeMethods.EnableMenuItem(systemMenu, 61456U, 1U);
                NativeMethods.EnableMenuItem(systemMenu, 61440U, 1U);
                NativeMethods.EnableMenuItem(systemMenu, 61488U, 1U);
                NativeMethods.EnableMenuItem(systemMenu, 61472U, uEnable);
                NativeMethods.EnableMenuItem(systemMenu, 61536U, 0U);
            }
            if (flag)
            {
                VisualUtilities.ModifyStyle(source.Handle, 0, 268435456);
            }
            var fuFlags = (uint)(systemMetrics | 256 | 128 | 2);
            var num     = NativeMethods.TrackPopupMenuEx(systemMenu, fuFlags, (int)screenPoint.X, (int)screenPoint.Y,
                                                         source.Handle, IntPtr.Zero);

            if (num == 0)
            {
                return;
            }
            NativeMethods.PostMessage(source.Handle, 274, new IntPtr(num), IntPtr.Zero);
        }
コード例 #28
0
 private void RePassTextKeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.Enter)
     {
         try
         {
             if (RePassText.Password.Length == 4)
             {
                 if (RePassText.Password.All(x => x >= '0' && x <= '9') && Helper.Passcode.Check(PassText.Password))
                 {
                     AddButtonClick(null, null);
                 }
                 else
                 {
                     VisualUtilities.ShakeView(RePassText);
                     Helper.ShowNotify("Enter 4-digits numbers");
                 }
             }
         }
         catch { }
     }
 }
コード例 #29
0
        private IntPtr WmHcHitTest(IntPtr lparam, ref bool handled)
        {
            if (PresentationSource.FromDependencyObject(this) == null)
            {
                return(new IntPtr(0));
            }
            var point1 = new Point(NativeMethods.GetXlParam(lparam.ToInt32()),
                                   NativeMethods.GetYlParam(lparam.ToInt32()));
            var point2 = PointFromScreen(point1);
            DependencyObject visualHit = null;

            VisualUtilities.HitTestVisibleElements(this,
                                                   target =>
            {
                visualHit = target.VisualHit;
                return(HitTestResultBehavior.Stop);
            }, new PointHitTestParameters(point2));
            var num = 0;

            for (; visualHit != null; visualHit = visualHit.GetVisualOrLogicalParent1())
            {
                var nonClientArea = visualHit as INonClientArea;
                if (nonClientArea == null)
                {
                    continue;
                }
                num = nonClientArea.HitTest(point1);
                if (num != 0)
                {
                    break;
                }
            }
            if (num == 0)
            {
                num = 1;
            }
            handled = true;
            return(new IntPtr(num));
        }
コード例 #30
0
        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            var check = sender as CheckBox;
            var item  = check.Tag as StorageChartItem;

            var index = Chart.Items.IndexOf(item);

            if (index < 0)
            {
                return;
            }

            if (item.IsVisible && Chart.Items.Except(new[] { item }).Any(x => x.IsVisible))
            {
                item.IsVisible  = false;
                check.IsChecked = false;

                Chart.Update(index, item.IsVisible);
            }
            else if (!item.IsVisible)
            {
                item.IsVisible  = true;
                check.IsChecked = true;

                Chart.Update(index, item.IsVisible);
            }
            else
            {
                VisualUtilities.ShakeView(check);
            }

            var size     = Chart.Items.Where(x => x.IsVisible).Sum(x => x.Size);
            var readable = FileSizeConverter.Convert(size, true).Split(' ');

            SizeLabel.Text = readable[0];
            UnitLabel.Text = readable[1];
        }