상속: System.Windows.FrameworkElement
예제 #1
1
        public void StoryboardTargetTest()
        {
            XamlNamespaces namespaces = new XamlNamespaces("http://schemas.microsoft.com/winfx/2006/xaml/presentation");

            ColorAnimation colorAnimation = new ColorAnimation { From = Colors.Green, To = Colors.Blue };
            Storyboard.SetTargetProperty(colorAnimation, PropertyPath.Parse("(Control.Background).(SolidColorBrush.Color)", namespaces));

            Storyboard storyboard = new Storyboard();
            storyboard.Children.Add(colorAnimation);

            TestRootClock rootClock = new TestRootClock();

            Control control = new Control();
            control.SetAnimatableRootClock(new AnimatableRootClock(rootClock, true));
            control.Background = new SolidColorBrush(Colors.Red);

            storyboard.Begin(control);

            rootClock.Tick(TimeSpan.FromSeconds(0));
            Assert.AreEqual(Colors.Green, ((SolidColorBrush)control.Background).Color);

            rootClock.Tick(TimeSpan.FromSeconds(0.5));
            Assert.IsTrue(Color.FromArgb(255, 0, (byte)(Colors.Green.G / 2), (byte)(Colors.Blue.B / 2)).IsClose(((SolidColorBrush)control.Background).Color));

            rootClock.Tick(TimeSpan.FromSeconds(1));
            Assert.AreEqual(Colors.Blue, ((SolidColorBrush)control.Background).Color);
        }
예제 #2
0
		internal void InitializeDialogPanel(bool modal, Control focusControl)
		{
		lock (m_Lock)
		{
			InitializeDialogPanel(modal, focusControl, ApplicationEx.LayoutRoot/*parent*/);
		}
		}
예제 #3
0
        public static void ScreenCapture(Control control, string filename)
        {
            try
            {
                // The BitmapSource that is rendered with a Visual.
                control.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                Size size = control.DesiredSize;
                int width = (int) size.Width;
                int height = (int) size.Height;
                control.Arrange(new Rect(0, 0, width, height));
                var rtb = new RenderTargetBitmap(width, height, 96, 96, PixelFormats.Pbgra32);
                rtb.Render(control);

                // Encoding the RenderBitmapTarget as a PNG file.
                var png = new PngBitmapEncoder();
                png.Frames.Add(BitmapFrame.Create(rtb));
                using (Stream stm = File.Create(filename))
                {
                    png.Save(stm);
                }
            }
            finally
            {
            }
        }
예제 #4
0
파일: History.cs 프로젝트: kevlut/UndoRedo
 public void Redo(Control control)
 {
     var hp = _redoStack.Pop();
     _undoStack.Push(hp.ToRedoPoint());
     hp.Redo();
     OnPropertyChanged("");
 }
 public InstrumentExplorerViewModel(MainWindow mainWindow,BookInfoViewModel bookInfoVM)
 {
     this.bookInfoVM_ = bookInfoVM;
     this.loadBookInfo();
     this.view_ = new ExplorerBookInstView(mainWindow, bookInfoVM_);
     this.view_.DataContext = this;
 }
예제 #6
0
		public void Activate(Control Container) {
			Container.ContextMenu = this;
			Container.ContextMenu.IsEnabled = true;
			Container.ContextMenu.PlacementTarget = Container;
			Container.ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
			Container.ContextMenu.IsOpen = true;
		}
예제 #7
0
        public static bool IsPresent(Control control)
        {
            if (control.GetType().ToString() == "System.Windows.Forms.TextBox")
            {
                TextBox textBox = (TextBox)control;
                if (textBox.Text == "")
                {
 //                   MessageBox.Show(textBox.Tag.ToString() + " is a required field.", Title);
                    // textBox.Focus();
                    return false;
                }
                else
                {
                    return true;
                }
            }
            else if (control.GetType().ToString() == "System.Windows.Forms.ComboBox")
            {
                ComboBox comboBox = (ComboBox)control;
                if (comboBox.SelectedIndex == -1)
                {
   //                 MessageBox.Show(comboBox.Tag.ToString() + " is a required field.", Title);
                    comboBox.Focus();
                    return false;
                }
                else
                {
                    return true;
                }
            }
            return true;
        }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TemplatedAdorner"/> class.
 /// </summary>
 /// <param name="adornedElement">The adorned element.</param>
 /// <param name="dataContext">The data context.</param>
 /// <param name="adornerTemplate">The adorner template.</param>
 public TemplatedAdorner(UIElement adornedElement, object dataContext, ControlTemplate adornerTemplate)
     : base(adornedElement)
 {
     _child = new Control {Template = adornerTemplate};
     DataContext = dataContext;
     AddVisualChild(_child);
 }
예제 #9
0
        /// <summary>
        /// Sets the spell checking culture of the specified control.
        /// </summary>
        /// <param name="control">
        /// The control.
        /// </param>
        /// <param name="value">
        /// The spell checking culture.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="value"/> parameter is null.
        /// </exception>
        public static void SetCulture(Control control, CultureInfo value)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            control.SetValue(CultureProperty, value);
        }
예제 #10
0
		public static void Verify(Control control)
		{
			using (addAdditionalInfo())
			{
				Approvals.Verify(new ImageWriter(f => WpfUtils.ScreenCapture(control, f)));
			}
		}
예제 #11
0
 public static void Focus(Control control)
 {
     if (control == null)
     {
         return;
     }
     var window = Window.GetWindow(control);
     if (window == null)
     {
         return;
     }
     //can't invoke Focus when window is inactive
     //since this causes issues with Window.Activated event and Window.IsActive value
     if (window.IsActive)
     {
         _controlToFocus = null;
         control.Focus();
     }
     else
     {
         window.Activated -= Window_Activated;
         window.Activated += Window_Activated;
         _controlToFocus = control;
     }
 }
예제 #12
0
        /// <summary>
        /// Sets the IsSendingMouseWheelEventToParent for a given <see cref="TextBox"/>.
        /// </summary>
        /// <param name="control">
        /// The <see cref="TextBox"/> whose IsSendingMouseWheelEventToParent is to be set.
        /// </param>
        /// <param name="IsSendingMouseWheelEventToParent">
        /// The IsSendingMouseWheelEventToParent to set, or <see langword="null"/>
        /// to remove any existing IsSendingMouseWheelEventToParent from <paramref name="control"/>.
        /// </param>
        public static void SetIsSendingMouseWheelEventToParent(Control control, bool? sendToParent)
        {
            if (control == null)
                throw new ArgumentNullException("");

            control.SetValue(ScrollProperty, sendToParent);
        }
예제 #13
0
        /// <summary>
        /// Gets spell checking culture of the specified control.
        /// </summary>
        /// <param name="control">
        /// The control.
        /// </param>
        /// <returns>
        /// The spell checking culture.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="control"/> parameter is null.
        /// </exception>
        public static CultureInfo GetCulture(Control control)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            return (CultureInfo)control.GetValue(CultureProperty);
        }
예제 #14
0
 public static void EnableControl(Control control, bool enabled)
 {
     if (control != null)
     {
         control.IsEnabled = enabled;
     }
 }
예제 #15
0
        /// <summary>
        /// Gets the IsSendingMouseWheelEventToParent for a given <see cref="TextBox"/>.
        /// </summary>
        /// <param name="control">
        /// The <see cref="TextBox"/> whose IsSendingMouseWheelEventToParent is to be retrieved.
        /// </param>
        /// <returns>
        /// The IsSendingMouseWheelEventToParent, or <see langword="null"/>
        /// if no IsSendingMouseWheelEventToParent has been set.
        /// </returns>
        public static bool? GetIsSendingMouseWheelEventToParent(Control control)
        {
            if (control == null)
                throw new ArgumentNullException("");

            return control.GetValue(ScrollProperty) as bool?;
        }
        /// <summary>
        /// Convert any control to a PngBitmapEncoder
        /// </summary>
        /// <param name="controlToConvert">The control to convert to an ImageSource</param>
        /// <returns>The returned ImageSource of the controlToConvert</returns>
        private static PngBitmapEncoder getImageFromControl(Control controlToConvert)
        {
            // save current canvas transform
            Transform transform = controlToConvert.LayoutTransform;

            // get size of control
            Size sizeOfControl = new Size(controlToConvert.ActualWidth, controlToConvert.ActualHeight);
            // measure and arrange the control
            controlToConvert.Measure(sizeOfControl);
            // arrange the surface
            controlToConvert.Arrange(new Rect(sizeOfControl));

            // craete and render surface and push bitmap to it
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((Int32)sizeOfControl.Width, (Int32)sizeOfControl.Height, 96d, 96d, PixelFormats.Pbgra32);
            // now render surface to bitmap
            renderBitmap.Render(controlToConvert);
            
            // encode png data
            PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
            // puch rendered bitmap into it
            pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));

            // return encoder
            return pngEncoder;
        }
예제 #17
0
    /// <summary>
    /// Create viewmodel objects for each view.
    /// </summary>
    public object CreateViewModel(Control control, string queryString)
    {
      object result = null;

      if (control is WpUI.MainPage)
        result = App.ViewModel.MainPageViewModel;
      
      else if (control is Views.Login)
        result = new ViewModels.Login();
      
      else if (control is Views.ProjectDetails)
        result = new ViewModels.ProjectDetail(queryString);
      
      else if (control is Views.ProjectEdit)
        result = new ViewModels.ProjectEdit(queryString);
      
      else if (control is Views.ResourceDetails)
        result = new ViewModels.ResourceDetail(queryString);
      
      else if (control is Views.ResourceEdit)
        result = new ViewModels.ResourceEdit(queryString);
      
      else if (control is Views.RoleListEdit)
        result = new ViewModels.RoleListEdit();

      else
        result = ((NavigationShell)Bxf.Shell.Instance).PendingView.Model;

      ((NavigationShell)Bxf.Shell.Instance).PendingView = null;

      return result;
    }
예제 #18
0
파일: UwpFunc.cs 프로젝트: vlad1000/priv10
    internal static void AddBinding(System.Windows.Controls.Control ctrl, KeyGesture keyGesture, ExecutedRoutedEventHandler executed)
    {
        RoutedCommand cmd = new RoutedCommand();

        cmd.InputGestures.Add(keyGesture);
        ctrl.CommandBindings.Add(new CommandBinding(cmd, executed));
    }
예제 #19
0
		public static string ScreeenCaptureInStaThread(string received, Control control)
		{
			Exception caught = null;
			var t = new Thread(() =>
			{
				try
				{
					ScreenCapture(control, received);
				}
				catch (Exception e)
				{
					caught = e;
				}
			});

			t.SetApartmentState(ApartmentState.STA); //Many WPF UI elements need to be created inside STA
			t.Start();
			t.Join();

			if (caught != null)
			{
				throw new Exception("Creating window failed.", caught);
			}

			return received;
		}
예제 #20
0
        private static void TrySetText(Control element, string text)
        {
            var peer = FrameworkElementAutomationPeer.FromElement(element);
            var provider = peer == null ? null : peer.GetPattern(PatternInterface.Value) as IValueProvider;

            if (provider != null)
            {
                provider.SetValue(text);
            }
            else if (element is TextBox)
            {
                var textBox = element as TextBox;
                textBox.Text = text;
                textBox.SelectionStart = text.Length;
            }
            else if (element is PasswordBox)
            {
                var passwordBox = element as PasswordBox;
                passwordBox.Password = text;
            }
            else
            {
                throw new AutomationException("Element does not support SendKeys.", ResponseStatus.UnknownError);
            }

            // TODO: new parameter - FocusState
            element.Focus();
        }
예제 #21
0
		public void SetParametersSource(List<System.Data.OleDb.OleDbParameter> parms)
		{
			int nRow = -1;
			foreach (var p in parms)
			{
				_grid.RowDefinitions.Add(new RowDefinition());
				++nRow;

				// create label
				var lbl = new Label();
				lbl.Content = CleanupName(p.ParameterName);
				lbl.SetValue(Grid.RowProperty, nRow);
				_grid.Children.Add(lbl);

				// create input control
				Control ctl = GetControl(p);
				ctl.Tag = p;
				ctl.SetValue(Grid.RowProperty, nRow);
				ctl.SetValue(Grid.ColumnProperty, 1);
				_grid.Children.Add(ctl);
				if (_focus == null)
				{
					_focus = ctl;
				}
			}
		}
예제 #22
0
        /// <summary>
        /// Bind commands to workbookview.
        /// </summary>
        /// <param name="workbookView"></param>
        public static void BindAllCommands(Control control)
        {
            control.CommandBindings.Add(new CommandCopyBinding());
            control.CommandBindings.Add(new CommandPasteBinding());
            //control.CommandBindings.Add(new CommandPasteBinding());

            control.CommandBindings.Add(new CommandUndoBinding());
            control.CommandBindings.Add(new CommandRedoBinding());

            control.CommandBindings.Add(new FormatCommandBinding());

            control.CommandBindings.Add(new BoldCommandBinding());
            control.CommandBindings.Add(new ItalicCommandBinding());
            control.CommandBindings.Add(new UnderlineCommandBinding());

            control.CommandBindings.Add(new CommandZoomInBinding());
            control.CommandBindings.Add(new CommandZoomOutBinding());

            control.CommandBindings.Add(new PercentCommandBinding());
            control.CommandBindings.Add(new ThousandSeperatorCommandBinding());
            control.CommandBindings.Add(new IncreaseDecimalCommandBinding());
            control.CommandBindings.Add(new DecreaseDecimalCommandBinding());

            control.CommandBindings.Add(new CommandSaveAsBinding());
            control.CommandBindings.Add(new PrintCommandBinding());

            control.CommandBindings.Add(new CommandAutoFilterBinding());
            //control.CommandBindings.Add(new CommandFindAndReplaceBinding());

            control.CommandBindings.Add(new HorizontalAlignmentCommandBinding());
            control.CommandBindings.Add(new VerticalAlignmentCommandBinding());
        }
예제 #23
0
        /// <summary>
        /// Init.
        /// </summary>
        public ControlAdapter(Control control)
            : base(WpfAdapter.Instance)
        {
            ArgChecker.AssertArgNotNull(control, "control");

            _control = control;
        }
예제 #24
0
            public static bool IsPresent(Control control)
            {
                if (control.GetType().ToString() == "System.Windows.Forms.TextBox")
                {
                    TextBox textBox = (TextBox)control;
                    if (textBox.Text == "")
                    {

                        //textBox.Focus();
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                else if (control.GetType().ToString() == "System.Windows.Forms.ComboBox")
                {
                    ComboBox comboBox = (ComboBox)control;
                    if (comboBox.SelectedIndex == -1)
                    {

                        // comboBox.Focus();
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                return true;
            }
예제 #25
0
        public void addXYControl(Control c)
        {
            XItems.Add(c);
            YItems.Add(c);

            // 一つずつ追加するのでこれでソートできるはず。
            // ソートについては甘々の可能性あり

            foreach (Control e in XItems)
            {
                int index = XItems.IndexOf(e) - 1;
                if(index < 0) index = 0;
                if (Canvas.GetLeft(e) > Canvas.GetLeft(c))
                {
                    XItems.Insert(index, c);
                    break;
                }
            }

            foreach (Control e in YItems)
            {
                int index = YItems.IndexOf(e) - 1;
                if (index < 0) index = 0;
                if (Canvas.GetBottom(e) > Canvas.GetBottom(c))
                {
                    YItems.Insert(index, c);
                    break;
                }
            }
        }
예제 #26
0
 public void initTextinput(int maxLen, int inputMode)
 {
     if (m_inputFlag == 0)
     {
         // kEditBoxInputFlagPassword
         PasswordBox pwdBox = new PasswordBox();
         pwdBox.MaxLength = maxLen < 0 ? 0 : maxLen;
         pwdBox.Password = m_strText;
         pwdBox.GotFocus += pwdBox_GotFocus;
         m_textinput = pwdBox;
     }
     else
     {
         TextBox textbox = new TextBox();
         textbox.MaxLength = maxLen < 0 ? 0 : maxLen;
         SetInputScope(textbox, inputMode);
         textbox.TextChanged += textinput_TextChanged;
         textbox.GotFocus += textinput_GotFocus;
         textbox.LostFocus += textinput_LostFocus;
         m_textinput = textbox;
     }
     m_textinput.Margin = new System.Windows.Thickness(0, 0, 220, 0);
     m_textinput.Height = 72.0;
     m_textinput.TabIndex = 0;
     m_textinput.VerticalAlignment = VerticalAlignment.Top;
     m_textinput.KeyDown += OnKeyDownHandler;
     this.LayoutRoot.Children.Add(m_textinput);
 }
예제 #27
0
        /// <summary>
        /// Ustawia domyślne właściwości kontrolek.
        /// </summary>
        /// <param name="page">Kontrolka.</param>
        /// <returns>Kontrolka wzbogacona o domyślne właściwości związane z wyświetlaniem na ekranie.</returns>
        protected Control SetDefaultPageAttributes(Control page)
        {
            page.Margin = new Thickness(0);
            page.Height = page.Width = double.NaN;

            return page;
        }
예제 #28
0
 public void ResetStatus(Control[] textBoxes = null, Label[] labels = null)
 {
     if (_dispatcher.CheckAccess())
     {
         if (textBoxes != null)
         {
             foreach (Control t in textBoxes)
             {
                 if (t != null)
                     t.Background = new SolidColorBrush(Colors.White);
             }
         }
         if (textBoxes != null && labels != null)
         {
             foreach (Label t in labels)
             {
                 if (t != null)
                     t.Foreground = new SolidColorBrush(Colors.Black);
             }
         }
         if (_errorText != null)
             _errorText.Visibility = Visibility.Hidden;
         if (_statusText != null)
             _statusText.Visibility = Visibility.Hidden;
     }
     else
     {
         _dispatcher.Invoke(new Action(() => ResetStatus(textBoxes, labels)));
     }
 }
예제 #29
0
		/// <summary>
		/// Initializes a new instance of the <see cref="AutoComplete"/> class.
		/// </summary>
		public AutoComplete( Control value )
		{
			InitializeComponent();

			this.controlUnderAutocomplete = ControlUnderAutoComplete.Create( value );

			this.viewSource = controlUnderAutocomplete.GetViewSource( ( Style )this[ this.controlUnderAutocomplete.StyleKey ] );
			this.viewSource.Filter += OnCollectionViewSourceFilter;

			this.controlUnderAutocomplete.Control.SetValue( Control.StyleProperty, this[ this.controlUnderAutocomplete.StyleKey ] );
			this.controlUnderAutocomplete.Control.ApplyTemplate();

			this.autoCompletePopup = ( Popup )this.controlUnderAutocomplete.Control.Template.FindName( "autoCompletePopup", this.controlUnderAutocomplete.Control );
			this._listBox = ( ListBox )this.controlUnderAutocomplete.Control.Template.FindName( "autoCompleteListBox", this.controlUnderAutocomplete.Control );

			var b = new Binding( "ActualWidth" )
			{
				UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
				Source = this.controlUnderAutocomplete.Control
			};

			this.ListBox.SetBinding( ListBox.MinWidthProperty, b );
			this.ListBox.PreviewMouseDown += OnListBoxPreviewMouseDown;

			this.controlUnderAutocomplete.Control.AddHandler( TextBox.TextChangedEvent, new TextChangedEventHandler( OnTextBoxTextChanged ) );
			this.controlUnderAutocomplete.Control.LostFocus += OnTextBoxLostFocus;
			this.controlUnderAutocomplete.Control.PreviewKeyUp += OnTextBoxPreviewKeyUp;
			this.controlUnderAutocomplete.Control.PreviewKeyDown += OnTextBoxPreviewKeyDown;
		}
        public override void Run(
            IAnimationContext context,
            Control control,
            TimeSpan duration,
            Action<Control> endMethod)
        {
            var storyboard = new Storyboard();

            DoubleAnimation fadeAnimation;

            if ( rounds > 1 )
            {
                fadeAnimation = new DoubleAnimation( startOpacity, endOpacity, new Duration( duration ) );
                fadeAnimation.AutoReverse = true;
                fadeAnimation.RepeatBehavior = new RepeatBehavior( rounds - 1 );
                storyboard.Children.Add( fadeAnimation );
                Storyboard.SetTarget( fadeAnimation, control );
                Storyboard.SetTargetProperty( fadeAnimation, new PropertyPath( UIElement.OpacityProperty ) );
            }

            fadeAnimation = new DoubleAnimation( startOpacity, endOpacity, new Duration( duration ) );
            fadeAnimation.BeginTime = TimeSpan.FromMilliseconds( duration.TotalMilliseconds * ( rounds - 1 ) * 2 );
            storyboard.Children.Add( fadeAnimation );
            Storyboard.SetTarget( fadeAnimation, control );
            Storyboard.SetTargetProperty( fadeAnimation, new PropertyPath( UIElement.OpacityProperty ) );

            if ( endMethod != null )
                storyboard.Completed += ( s, a ) => endMethod( control );
            storyboard.Begin( control );
        }
 /// <summary>
 /// Initializes a new instance of <see cref="ControlContainer"/> for specified <see cref="Control"/>.
 /// </summary>
 /// <param name="Control">Control</param>
 public ControlContainer(Control Control)
 {
     if (Control == null) {
         throw new ArgumentException("Control cannot be null");
     }
     this.Control = Control;
 }
예제 #32
0
        private bool Save()
        {
            foreach (var keyValue in controls)
            {
                Controls.Control control = keyValue.Key;
                PropertyInfo     prop    = keyValue.Value;

                if (prop.PropertyType.Name == "String")
                {
                    string value = (control as TextBox).Text;
                    SettingDisableEmptyAttribute attri = prop.GetCustomAttribute <SettingDisableEmptyAttribute>();
                    if (attri != null)
                    {
                        bool disable = attri.IncludeWhiteSpace ? string.IsNullOrWhiteSpace(value) : string.IsNullOrEmpty(value);
                        if (disable)
                        {
                            Dialog.MessageBox.ShowError("设置“" + GetName(prop) + "”的值不可为空", this);
                            return(false);
                        }
                    }

                    prop.SetValue(SettingInstance, value);
                }
                else if (prop.PropertyType.Name == "Int32")
                {
                    int?value = (control as NumberTextBox).IntNumber;
                    if (!value.HasValue)
                    {
                        Dialog.MessageBox.ShowError("设置“" + GetName(prop) + "”的值不是整数", this);
                        return(false);
                    }
                    var attriNum = prop.GetCustomAttribute <LimitedNumberSettingAttribute>();
                    if (attriNum != null)
                    {
                        if (value.Value < attriNum.NumberMin)
                        {
                            Dialog.MessageBox.ShowError("设置“" + GetName(prop) + "”的值不应小于" + attriNum.NumberMin, this);
                            return(false);
                        }
                        if (value.Value > attriNum.NumberMax)
                        {
                            Dialog.MessageBox.ShowError("设置“" + GetName(prop) + "”的值不应大于" + attriNum.NumberMax, this);
                            return(false);
                        }
                    }
                    prop.SetValue(SettingInstance, value.Value);
                }
                else if (prop.PropertyType.Name == "Double")
                {
                    double?value = (control as NumberTextBox).DoubleNumber;
                    if (!value.HasValue)
                    {
                        Dialog.MessageBox.ShowError("设置“" + GetName(prop) + "”的值不是整数", this);
                        return(false);
                    }
                    var attriNum = prop.GetCustomAttribute <LimitedNumberSettingAttribute>();
                    if (attriNum != null)
                    {
                        if (value.Value < attriNum.NumberMin)
                        {
                            Dialog.MessageBox.ShowError("设置“" + GetName(prop) + "”的值不应小于" + attriNum.NumberMin, this);
                            return(false);
                        }
                        if (value.Value > attriNum.NumberMax)
                        {
                            Dialog.MessageBox.ShowError("设置“" + GetName(prop) + "”的值不应大于" + attriNum.NumberMax, this);
                            return(false);
                        }
                    }
                    prop.SetValue(SettingInstance, value.Value);
                }
                else if (prop.PropertyType.Name == "Boolean")
                {
                    bool value = (control as CheckBox).IsChecked.Value;

                    prop.SetValue(SettingInstance, value);
                }
                else if (prop.PropertyType.Name == "SolidColorBrush")
                {
                    SolidColorBrush value = (control as FzLib.UI.Picker.ColorPickerTextBox).ColorBrush;

                    prop.SetValue(SettingInstance, value);
                }
                else if (prop.PropertyType.Name == "Color")
                {
                    Color value = (control as FzLib.UI.Picker.ColorPickerTextBox).ColorBrush.Color;

                    prop.SetValue(SettingInstance, value);
                }
            }
            return(true);
        }
예제 #33
0
 public static Font GetEtoFont(this swc.Control control)
 {
     return(new Font(new FontHandler(control)));
 }
        public static void SetTextboxTextValue([NotNull] System.Windows.Controls.TextBox textBox, [NotNull] string value, [CanBeNull] System.Windows.Controls.Control otherControl)
        {
            Assert.ArgumentNotNull(textBox, nameof(textBox));
            Assert.ArgumentNotNull(value, nameof(value));

            textBox.Text = value;
            textBox.Focus();
            if (otherControl != null)
            {
                otherControl.Focus();
            }
        }
        public static void PickFolder([NotNull] string message, [NotNull] System.Windows.Controls.TextBox textBox, [CanBeNull] System.Windows.Controls.Control otherControl, string initialPath = null)
        {
            Assert.ArgumentNotNull(message, nameof(message));
            Assert.ArgumentNotNull(textBox, nameof(textBox));

            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog
            {
                Description = message
            };

            var path = textBox.Text.EmptyToNull() ?? initialPath;

            if (!string.IsNullOrEmpty(path))
            {
                if (!string.IsNullOrEmpty(path) && SIM.FileSystem.FileSystem.Local.Directory.Exists(path))
                {
                    folderBrowserDialog.SelectedPath = path;
                }
            }

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                var value = folderBrowserDialog.SelectedPath;
                SetTextboxTextValue(textBox, value, otherControl);
            }
        }
        public static string PickFile([NotNull] string message, [CanBeNull] System.Windows.Controls.TextBox textBox, [CanBeNull] System.Windows.Controls.Control otherControl, [NotNull] string pattern)
        {
            Assert.ArgumentNotNullOrEmpty(message, nameof(message));
            Assert.ArgumentNotNullOrEmpty(pattern, nameof(pattern));

            OpenFileDialog fileBrowserDialog = new OpenFileDialog
            {
                Title           = message,
                Multiselect     = false,
                CheckFileExists = true,
                Filter          = pattern
            };

            var filePath = textBox != null ? textBox.Text : string.Empty;
            var fileName = Path.GetFileName(filePath);

            if (!string.IsNullOrEmpty(fileName) && SIM.FileSystem.FileSystem.Local.File.Exists(filePath))
            {
                fileBrowserDialog.FileName         = fileName;
                fileBrowserDialog.InitialDirectory = Path.GetDirectoryName(filePath);
            }

            if (fileBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                if (textBox != null)
                {
                    textBox.Text = fileBrowserDialog.FileName;
                    textBox.Focus();
                    if (otherControl != null)
                    {
                        otherControl.Focus();
                    }
                }

                return(fileBrowserDialog.FileName);
            }

            return(null);
        }
예제 #37
0
 public static Window GetWindow(this Control control)
 {
     return(Window.GetWindow(control));
 }
예제 #38
0
        private void Load()
        {
            controls = new Dictionary <Controls.Control, PropertyInfo>();
            Type type = SettingInstance.GetType();


            PropertyInfo[] properties  = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
            Grid           currentGrid = null;

            foreach (var prop in properties)
            {
                if (Attribute.IsDefined(prop, typeof(InvisibleSettingAttribute)))
                {
                    continue;
                }

                var group = prop.GetCustomAttribute <SettingGroupAttribute>();
                if (group == null || string.IsNullOrWhiteSpace(group.GroupName))
                {
                    currentGrid = GetGrid("");
                }
                else
                {
                    currentGrid = GetGrid(group.GroupName);
                }

                string name     = GetName(prop);
                int    rowCount = currentGrid.RowDefinitions.Count;

                currentGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
                currentGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(8)
                });



                object           value        = prop.GetValue(SettingInstance);
                Controls.Control valueControl = null;
                if (value is string || value is int || value is double || value is SolidColorBrush || value is Color)
                {
                    TextBlock tbk = null;
                    if (value is string)
                    {
                        tbk = new TextBlock()
                        {
                            Text = name
                        };
                        valueControl = new FzLib.UI.FlatStyle.TextBox()
                        {
                            Text = value as string
                        };
                    }
                    else if (value is int)
                    {
                        tbk = new TextBlock()
                        {
                            Text = name
                        };
                        valueControl = new NumberTextBox()
                        {
                            MatchMode = NumberTextBox.Mode.IntegerNumber
                        };
                        (valueControl as TextBox).Text = ((int)value).ToString();
                    }
                    else if (value is double)
                    {
                        tbk = new TextBlock()
                        {
                            Text = name
                        };
                        valueControl = new NumberTextBox()
                        {
                            MatchMode = NumberTextBox.Mode.All
                        };
                        (valueControl as TextBox).Text = ((double)value).ToString();
                    }
                    else if (value is SolidColorBrush)
                    {
                        tbk = new TextBlock()
                        {
                            Text = name
                        };
                        valueControl = new FzLib.UI.Picker.ColorPickerTextBox()
                        {
                            ColorBrush = value as SolidColorBrush
                        };
                    }
                    else if (value is Color)
                    {
                        tbk = new TextBlock()
                        {
                            Text = name
                        };
                        valueControl = new FzLib.UI.Picker.ColorPickerTextBox()
                        {
                            ColorBrush = new SolidColorBrush((Color)value)
                        };
                    }
                    currentGrid.Children.Add(tbk);
                    Grid.SetRow(tbk, rowCount);
                    currentGrid.Children.Add(valueControl);
                    Grid.SetRow(valueControl, rowCount);
                    Grid.SetColumn(valueControl, 2);
                }
                else if (value is bool)
                {
                    valueControl = new FzLib.UI.FlatStyle.CheckBox()
                    {
                        Content = name, IsChecked = (bool)value
                    };

                    currentGrid.Children.Add(valueControl);
                    Grid.SetRow(valueControl, rowCount);
                    Grid.SetColumnSpan(valueControl, 3);
                }
                controls.Add(valueControl, prop);
            }
            if (mainPanel.Children.Count > 2 && groups.ContainsKey(""))
            {
                Grid grid = groups[""] as Grid;
                grid.Margin = new Thickness(10, 0, 0, 0);
            }
        }
예제 #39
0
 public static void ActInputValueBinding(System.Windows.Controls.Control control, DependencyProperty dependencyProperty, ActInputValue actInputValue, BindingMode BindingMode = BindingMode.TwoWay)
 {
     ObjFieldBinding(control, dependencyProperty, actInputValue, ActInputValue.Fields.Value, BindingMode);
 }
예제 #40
0
        public static void LoadAndMonitor(INotifyPropertyChanged source, string sourceProperty, System.Windows.Controls.Control control, System.Windows.DependencyProperty controlProperty = null)
        {
            if (controlProperty == null)
            {
                if (control is System.Windows.Controls.TextBox)
                {
                    controlProperty = System.Windows.Controls.TextBox.TextProperty;
                }
                if (control is System.Windows.Controls.CheckBox)
                {
                    controlProperty = System.Windows.Controls.Primitives.ToggleButton.IsCheckedProperty;
                }
                if (control is System.Windows.Controls.ComboBox || control is System.Windows.Controls.ListBox)
                {
                    controlProperty = System.Windows.Controls.Primitives.Selector.SelectedValueProperty;
                }
            }
            var binding = new System.Windows.Data.Binding(sourceProperty);

            binding.Source  = source;
            binding.IsAsync = true;
            control.SetBinding(controlProperty, binding);
        }
예제 #41
0
 public static void ActInputValueBinding(System.Windows.Controls.Control control, DependencyProperty dependencyProperty, ActInputValue actInputValue, IValueConverter bindingConvertor = null, BindingMode BindingMode = BindingMode.TwoWay)
 {
     ObjFieldBinding(control, dependencyProperty, actInputValue, nameof(ActInputValue.Value), bindingConvertor, BindingMode);
 }
예제 #42
0
        public GameSettingsControl()
        {
            foreach (UInt16 frequency in EnumerateAudioSettings())
            {
                _validSamplingFrequency.Add(frequency);
            }

            SetCols(2);
            SetRows(9);

            Width               = 200;
            VerticalAlignment   = VerticalAlignment.Top;
            HorizontalAlignment = HorizontalAlignment.Left;
            Margin              = new Thickness(5);
            DataContext         = this;

            LinearGradientBrush backgroundStroke = new LinearGradientBrush
            {
                EndPoint          = new Point(0.5, 1),
                StartPoint        = new Point(0.5, 0),
                RelativeTransform = new RotateTransform(115, 0.5, 0.5),
                GradientStops     = new GradientStopCollection
                {
                    new GradientStop(Color.FromArgb(0xff, 0x61, 0x61, 0x61), 0),
                    new GradientStop(Color.FromArgb(0xff, 0xF2, 0xF2, 0xF2), 0.504),
                    new GradientStop(Color.FromArgb(0xff, 0xAE, 0xB1, 0xB1), 1)
                }
            };

            backgroundStroke.Freeze();

            LinearGradientBrush backgroundFill = new LinearGradientBrush
            {
                MappingMode   = BrushMappingMode.RelativeToBoundingBox,
                StartPoint    = new Point(0.5, 1.0),
                EndPoint      = new Point(0.5, -0.4),
                GradientStops = new GradientStopCollection
                {
                    new GradientStop(Color.FromArgb(0xBB, 0x44, 0x71, 0xc1), 0),
                    new GradientStop(Color.FromArgb(0xBB, 0x28, 0x36, 0x65), 1)
                }
            };

            backgroundFill.Freeze();

            Rectangle backround = AddUiElement(new Rectangle {
                Stroke = backgroundStroke, Fill = backgroundFill, StrokeThickness = 5
            }, 0, 0, 9, 2);

            Thickness rowMargin = new Thickness(0, 8, 0, 3);

            AddUiElement(UiTextBlockFactory.Create(Lang.Settings.ActiveMonitor), row: 0, col: 0, colSpan: 2).Margin = rowMargin;
            UiComboBox monitor = AddUiElement(UiComboBoxFactory.Create(), row: 1, col: 0, rowSpan: 0, colSpan: 2);

            monitor.ItemsSource = GetAvailableMonitors();
            monitor.SetBinding(Selector.SelectedItemProperty, new Binding(nameof(ActiveMonitor))
            {
                Mode = BindingMode.TwoWay
            });
            monitor.Margin = rowMargin;

            AddUiElement(UiTextBlockFactory.Create(Lang.Settings.Resolution), row: 2, col: 0).Margin = rowMargin;
            UiComboBox resolution = AddUiElement(UiComboBoxFactory.Create(), row: 3, col: 0);

            resolution.ItemsSource = EnumerateDisplaySettings().ToArray();
            resolution.SetBinding(Selector.SelectedItemProperty, new Binding(nameof(ScreenResolution))
            {
                Mode = BindingMode.TwoWay
            });
            resolution.Margin = rowMargin;

            UiCheckBox windowedCheckBox = AddUiElement(UiCheckBoxFactory.Create(Lang.Settings.Windowed, null), row: 3, col: 1);

            windowedCheckBox.Margin = rowMargin;
            windowedCheckBox.SetBinding(ToggleButton.IsCheckedProperty, new Binding(nameof(Windowed))
            {
                Mode = BindingMode.TwoWay
            });

            AddUiElement(UiTextBlockFactory.Create(Lang.Settings.AudioSamplingFrequency), 4, 0, 0, 2).Margin = rowMargin;
            UiComboBox audio = AddUiElement(UiComboBoxFactory.Create(), 5, 0, 0, 2);

            audio.ItemStringFormat = Lang.Settings.AudioSamplingFrequencyFormat;
            audio.ItemsSource      = EnumerateAudioSettings().ToArray();
            audio.SetBinding(Selector.SelectedItemProperty, new Binding(nameof(AudioFrequency))
            {
                Mode = BindingMode.TwoWay
            });
            audio.SetBinding(Selector.IsEnabledProperty, new Binding(nameof(AudioFrequencyEnabled))
            {
                Mode = BindingMode.TwoWay
            });
            audio.Margin = rowMargin;

            UiCheckBox x64 = AddUiElement(UiCheckBoxFactory.Create("X64", null), 6, 0);

            x64.Margin = rowMargin;
            x64.SetBinding(ToggleButton.IsCheckedProperty, new Binding(nameof(IsX64))
            {
                Mode = BindingMode.TwoWay
            });
            x64.SetBinding(ToggleButton.IsEnabledProperty, new Binding(nameof(IsX64Enabled))
            {
                Mode = BindingMode.TwoWay
            });

            UiCheckBox debuggableCheckBox = AddUiElement(UiCheckBoxFactory.Create(Lang.Settings.Debuggable, null), 6, 1);

            debuggableCheckBox.Margin = rowMargin;
            debuggableCheckBox.SetBinding(ToggleButton.IsCheckedProperty, new Binding(nameof(IsDebugMode))
            {
                Mode = BindingMode.TwoWay
            });

            UiCheckBox checkUpdates = AddUiElement(UiCheckBoxFactory.Create(Lang.Settings.CheckUpdates, null), 7, 0, 0, 2);

            checkUpdates.Margin = new Thickness(0, 8, 0, 8);
            checkUpdates.SetBinding(ToggleButton.IsCheckedProperty, new Binding(nameof(CheckUpdates))
            {
                Mode = BindingMode.TwoWay
            });

            foreach (FrameworkElement child in Children)
            {
                if (!ReferenceEquals(child, backround))
                {
                    child.Margin = new Thickness(child.Margin.Left + 8, child.Margin.Top, child.Margin.Right + 8, child.Margin.Bottom);
                }

                TextBlock textblock = child as TextBlock;
                if (textblock != null)
                {
                    textblock.Foreground = Brushes.WhiteSmoke;
                    textblock.FontWeight = FontWeight.FromOpenTypeWeight(500);
                    continue;
                }

                Control control = child as Control;
                if (control != null && !(control is ComboBox))
                {
                    control.Foreground = Brushes.WhiteSmoke;
                }
            }

            LoadSettings();
        }
예제 #43
0
 public static bool TryBeginInvoke <T0, T1, T2, T3, T4>(this Control control,
                                                        Action <T0, T1, T2, T3, T4> action, T0 p0, T1 p1, T2 p2, T3 p3, T4 p4)
 {
     return(control.TryBeginInvoke(() => action(p0, p1, p2, p3, p4)));
 }
예제 #44
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.configWnd = ((NeathCopy.UsedWindows.ConfigurationWindow)(target));

            #line 6 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.configWnd.Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden

            #line 6 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.configWnd.Closing += new System.ComponentModel.CancelEventHandler(this.configWnd_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.fileMenu = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 3:
                this.toolsMenu = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 4:
                this.addToFirsth_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 24 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.addToFirsth_rb.Checked += new System.Windows.RoutedEventHandler(this.addToFirsth_rb_Checked);

            #line default
            #line hidden
                return;

            case 5:
                this.addToLast_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 25 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.addToLast_rb.Checked += new System.Windows.RoutedEventHandler(this.addToLast_rb_Checked);

            #line default
            #line hidden
                return;

            case 6:
                this.add_SameDestiny_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 26 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.add_SameDestiny_rb.Checked += new System.Windows.RoutedEventHandler(this.add_SameDestiny_rb_Checked);

            #line default
            #line hidden
                return;

            case 7:
                this.add_SameVolumen_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 27 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.add_SameVolumen_rb.Checked += new System.Windows.RoutedEventHandler(this.add_SameVolumen_rb_Checked);

            #line default
            #line hidden
                return;

            case 8:
                this.sob_AutomatlyStart_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 32 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.sob_AutomatlyStart_rb.Checked += new System.Windows.RoutedEventHandler(this.sob_AutomatlyStart_rb_Checked);

            #line default
            #line hidden
                return;

            case 9:
                this.sob_WaitInQueve_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 33 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.sob_WaitInQueve_rb.Checked += new System.Windows.RoutedEventHandler(this.sob_WaitInQueve_rb_Checked);

            #line default
            #line hidden
                return;

            case 10:
                this.copyEngine_cb = ((System.Windows.Controls.ComboBox)(target));

            #line 42 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.copyEngine_cb.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.copyEngine_cb_SelectionChanged);

            #line default
            #line hidden
                return;

            case 11:
                this.bufferSize_textBox = ((System.Windows.Controls.TextBox)(target));

            #line 47 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.bufferSize_textBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.bufferSize_textBox_TextChanged);

            #line default
            #line hidden
                return;

            case 12:
                this.ps_affter_ADD_DATA_cb = ((System.Windows.Controls.CheckBox)(target));

            #line 57 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.ps_affter_ADD_DATA_cb.Click += new System.Windows.RoutedEventHandler(this.ps_affter_ADD_DATA_cb_Click);

            #line default
            #line hidden
                return;

            case 13:
                this.ps_affter_Finish_cb = ((System.Windows.Controls.CheckBox)(target));

            #line 58 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.ps_affter_Finish_cb.Click += new System.Windows.RoutedEventHandler(this.ps_affter_Finish_cb_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.ps_When_Cancel_cb = ((System.Windows.Controls.CheckBox)(target));

            #line 59 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.ps_When_Cancel_cb.Click += new System.Windows.RoutedEventHandler(this.ps_When_Cancel_cb_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.ancb_All_In_One_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 64 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.ancb_All_In_One_rb.Checked += new System.Windows.RoutedEventHandler(this.ancb_All_In_One_rb_Checked);

            #line default
            #line hidden
                return;

            case 16:
                this.ancb_Use_Separate_Windos_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 65 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.ancb_Use_Separate_Windos_rb.Checked += new System.Windows.RoutedEventHandler(this.ancb_Use_Separate_Windos_rb_Checked);

            #line default
            #line hidden
                return;

            case 17:
                this.closeAffterError_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 73 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.closeAffterError_rb.Checked += new System.Windows.RoutedEventHandler(this.closeAffterError_rb_Checked);

            #line default
            #line hidden
                return;

            case 18:
                this.keepAffterError_rb = ((System.Windows.Controls.RadioButton)(target));

            #line 74 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.keepAffterError_rb.Checked += new System.Windows.RoutedEventHandler(this.keepAffterError_rb_Checked);

            #line default
            #line hidden
                return;

            case 19:
                this.language_cb = ((System.Windows.Controls.ComboBox)(target));

            #line 85 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.language_cb.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.language_cb_SelectionChanged);

            #line default
            #line hidden
                return;

            case 20:
                this.theme_cb = ((System.Windows.Controls.ComboBox)(target));

            #line 93 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.theme_cb.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.theme_cb_SelectionChanged);

            #line default
            #line hidden
                return;

            case 21:
                this.skins_cb = ((System.Windows.Controls.ComboBox)(target));

            #line 97 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.skins_cb.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.skins_cb_SelectionChanged);

            #line default
            #line hidden
                return;

            case 22:
                this.brushes_cb = ((System.Windows.Controls.ComboBox)(target));

            #line 101 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.brushes_cb.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.brushes_cb_SelectionChanged);

            #line default
            #line hidden
                return;

            case 23:
                this.font_cb = ((System.Windows.Controls.ComboBox)(target));

            #line 105 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.font_cb.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.font_cb_SelectionChanged);

            #line default
            #line hidden
                return;

            case 24:
                this.skinControl = ((System.Windows.Controls.Control)(target));
                return;

            case 25:
                this.updateTime_tb = ((System.Windows.Controls.TextBox)(target));

            #line 141 "..\..\..\UsedWindows\ConfigurationWindow.xaml"
                this.updateTime_tb.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.updateTime_tb_TextChanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
예제 #45
0
 public static bool TryBeginInvoke <T0>(this Control control, Action <T0> action, T0 p0)
 {
     return(control.TryBeginInvoke(() => action(p0)));
 }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl = ((PictureBrowserPanel.MyCoverFlow)(target));
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.viewport3D = ((System.Windows.Controls.Viewport3D)(target));
                return;

            case 4:
                this.Camera = ((System.Windows.Media.Media3D.PerspectiveCamera)(target));
                return;

            case 5:
                this.L5 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 6:
                this.CT_L5 = ((System.Windows.Controls.Control)(target));
                return;

            case 7:
                this.L4 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 8:
                this.CT_L4 = ((System.Windows.Controls.Control)(target));
                return;

            case 9:
                this.L3 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 10:
                this.CT_L3 = ((System.Windows.Controls.Control)(target));
                return;

            case 11:
                this.L2 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 12:
                this.CT_L2 = ((System.Windows.Controls.Control)(target));
                return;

            case 13:
                this.L1 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 14:
                this.CT_L1 = ((System.Windows.Controls.Control)(target));
                return;

            case 15:
                this.C = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 16:
                this.CT_C = ((System.Windows.Controls.Control)(target));
                return;

            case 17:
                this.R1 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 18:
                this.CT_R1 = ((System.Windows.Controls.Control)(target));
                return;

            case 19:
                this.R2 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 20:
                this.CT_R2 = ((System.Windows.Controls.Control)(target));
                return;

            case 21:
                this.R3 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 22:
                this.CT_R3 = ((System.Windows.Controls.Control)(target));
                return;

            case 23:
                this.R4 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 24:
                this.CT_R4 = ((System.Windows.Controls.Control)(target));
                return;

            case 25:
                this.R5 = ((_3DTools.InteractiveVisual3D)(target));
                return;

            case 26:
                this.CT_R5 = ((System.Windows.Controls.Control)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #47
0
 private void MarkCell(System.Windows.Controls.Control cell, string validationText)
 {
     ToolTipService.SetToolTip(cell, validationText);
 }
예제 #48
0
 public static bool TryBeginInvoke <T0, T1, T2>(this Control control, Action <T0, T1, T2> action, T0 p0, T1 p1, T2 p2)
 {
     return(control.TryBeginInvoke(() => action(p0, p1, p2)));
 }
예제 #49
0
        //***************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="Ctrl"></param>
        /// <param name="i_sub_width"></param>
        /// <param name="i_sub_height"></param>
        /// <param name="bl_animation"></param>
        /// <param name="i_loop"></param>
        /// <param name="bl_upper"></param>
        //***************************************************************
        public void umdSetCtrlSize_Sub(System.Windows.Controls.Control Ctrl, int i_sub_width, int i_sub_height, bool bl_animation, int i_loop, bool bl_upper)
        {
            int iStepWidth = 0, iStepHeigh = 0;
            int iRemainingWidth = 0, iRemainingHeigh = 0;

            bool blWidthOver = false, blHeightOver = false;

            if (Ctrl.Width - 10 <= i_sub_width)
            {
                blWidthOver = true;
            }
            if (Ctrl.Height - 10 <= i_sub_height)
            {
                blHeightOver = true;
            }


            if (!bl_animation)//アニメーション無しの時は単純に足して終わり
            {
                if (!blWidthOver)
                {
                    Ctrl.Width -= i_sub_width;
                }
                if (!blHeightOver)
                {
                    Ctrl.Height -= i_sub_height;
                }
            }
            else//アニメーションが必要な時
            {
                //幅--------------------------------
                if (!blWidthOver)
                {
                    //ステップ値と余りを取得
                    iStepWidth      = i_sub_width / i_loop;
                    iRemainingWidth = i_sub_width % i_loop;
                    //最初に余りの値をプラス
                    Ctrl.Width -= iRemainingWidth;
                }
                //高さ------------------------------------
                if (!blHeightOver)
                {
                    //ステップ値と余りを取得
                    iStepHeigh      = i_sub_height / i_loop;
                    iRemainingHeigh = i_sub_height % i_loop;
                    //最初に余りの値をプラス
                    Ctrl.Height -= iRemainingHeigh;
                }
                DoEvents();

                //アニメーションループ
                for (int i = 0; i < i_loop; i++)
                {
                    if (!blWidthOver)
                    {
                        Ctrl.Width -= iStepWidth;
                    }
                    if (!blHeightOver)
                    {
                        Ctrl.Height -= iStepHeigh;
                    }
                    DoEvents();
                }
            }
        }
예제 #50
0
 private void RestoreCell(System.Windows.Controls.Control cell)
 {
     ToolTipService.SetToolTip(cell, null);
 }
예제 #51
0
        private void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e)
        {
            if (CanEdit && !IsPlaying)
            {
                System.Windows.Controls.Control designerItem = this.DataContext as System.Windows.Controls.Control;

                double changeWidth = Math.Ceiling(e.HorizontalChange / BaseWidth) * BaseWidth;
                if (Math.Abs(changeWidth) < BaseWidth)
                {
                    return;
                }
                if (designerItem != null)
                {
                    double deltaVertical, deltaHorizontal;

                    switch (this.VerticalAlignment)
                    {
                    case System.Windows.VerticalAlignment.Bottom:
                        deltaVertical        = Math.Min(-e.VerticalChange, designerItem.ActualHeight - designerItem.MinHeight);
                        designerItem.Height -= deltaVertical;
                        break;

                    case System.Windows.VerticalAlignment.Top:
                        deltaVertical = Math.Min(e.VerticalChange, designerItem.ActualHeight - designerItem.MinHeight);
                        Canvas.SetTop(designerItem, Canvas.GetTop(designerItem) + deltaVertical);
                        designerItem.Height -= deltaVertical;
                        break;

                    default:
                        break;
                    }

                    switch (HorizontalAlignment)
                    {
                    case System.Windows.HorizontalAlignment.Left:
                        deltaHorizontal = Math.Min(changeWidth, designerItem.ActualWidth - designerItem.MinWidth);
                        Canvas.SetLeft(designerItem, Canvas.GetLeft(designerItem) + deltaHorizontal);
                        designerItem.Width -= deltaHorizontal;
                        break;

                    case System.Windows.HorizontalAlignment.Right:

                        deltaHorizontal     = Math.Min(-changeWidth, designerItem.ActualWidth - designerItem.MinWidth);
                        designerItem.Width -= deltaHorizontal;
                        break;

                    default:
                        break;
                    }
                    BarWidth        = designerItem.Width;
                    ResizeStartTime = (int)(Canvas.GetLeft(designerItem) / BaseWidth);
                    ResizeEndTime   = ResizeStartTime + Math.Floor(BarWidth / BaseWidth);
                    if ((ResizeStartTime * BaseWidth + BarWidth) > TimeLineWidth)
                    {
                        TimeLineWidth = ResizeStartTime * BaseWidth + BarWidth;
                        RoutedEventArgs args = new RoutedEventArgs(TimeLineWidthChangedRoutedEvent, this);
                        RaiseEvent(args);
                    }
                }

                e.Handled = true;
            }
        }
예제 #52
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.userControl = ((BPiaoBao.Client.UIExt.CommonControl.PayControl)(target));
                return;

            case 2:
                this.VisualStateGroup = ((System.Windows.VisualStateGroup)(target));
                return;

            case 3:
                this.CashState = ((System.Windows.VisualState)(target));
                return;

            case 4:
                this.CreditState = ((System.Windows.VisualState)(target));
                return;

            case 5:
                this.bg = ((System.Windows.Controls.Border)(target));
                return;

            case 6:
                this.headContent = ((System.Windows.Controls.Control)(target));
                return;

            case 7:
                this.listBoxPlatform = ((System.Windows.Controls.ListBox)(target));
                return;

            case 8:
                this.payByPlatformBtn = ((System.Windows.Controls.Button)(target));

            #line 120 "..\..\..\CommonControl\PayControl.xaml"
                this.payByPlatformBtn.Click += new System.Windows.RoutedEventHandler(this.payByPlatform_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.listBox = ((System.Windows.Controls.ListBox)(target));
                return;

            case 10:
                this.payByBankBtn = ((System.Windows.Controls.Button)(target));

            #line 133 "..\..\..\CommonControl\PayControl.xaml"
                this.payByBankBtn.Click += new System.Windows.RoutedEventHandler(this.payByBankBtn_Click);

            #line default
            #line hidden
                return;

            case 11:
                this.radioBtnCashbag = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 12:
                this.radioBtnCredit = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 13:
                this.txtCash = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 14:
                this.txtCredit = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 15:
                this.passwordBox = ((System.Windows.Controls.PasswordBox)(target));
                return;

            case 16:
                this.payBtn = ((System.Windows.Controls.Button)(target));

            #line 203 "..\..\..\CommonControl\PayControl.xaml"
                this.payBtn.Click += new System.Windows.RoutedEventHandler(this.payBtn_Click);

            #line default
            #line hidden
                return;

            case 17:
                this.ApliPayRadioButton = ((System.Windows.Controls.RadioButton)(target));
                return;

            case 18:
                this.aplipaypasswordBox = ((System.Windows.Controls.PasswordBox)(target));
                return;

            case 19:
                this.PayByQuikAliPayBtn = ((System.Windows.Controls.Button)(target));

            #line 229 "..\..\..\CommonControl\PayControl.xaml"
                this.PayByQuikAliPayBtn.Click += new System.Windows.RoutedEventHandler(this.PayByQuikAliPayBtn_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }