コード例 #1
0
 public InputBox(string message)
 {
     InitializeComponent();
     ValueTextBox.Focus();
     messageTextBlock.Text = message;
     value = 0;
 }
コード例 #2
0
        public ExpensePage(Flyout parentFlyout, Expense exp, ExpenseCategory cat, DateTime?datetime)
        {
            InitializeComponent();

            parent  = parentFlyout;
            expense = exp;
            if (expense != null)
            {
                category = expense.category;
                date     = expense.date;
                DeleteButton.IsEnabled = true;
                TitleTextBlock.Text    = "Edycja wydatku";
            }
            else
            {
                category                = cat;
                date                    = datetime;
                TitleTextBlock.Text     = "Nowy wydatek";
                DeleteButton.Visibility = Visibility.Collapsed;
            }

            LoadCategories();
            SetupDatePicker();
            FillWithCorrectValues();

            ValueTextBox.Focus();
        }
コード例 #3
0
 public void Init(string title, string message, Object obj, string Property)
 {
     winTitle.Content  = title;
     MessageLabel.Text = message;
     ObjFieldBinding(ValueTextBox, TextBox.TextProperty, obj, Property);
     mOriginalValue = ValueTextBox.Text;
     ValueTextBox.Focus();
 }
コード例 #4
0
 public void Init(string title, string message, ref string Value, bool isMultiline)
 {
     if (!isMultiline)
     {
         ValueTextBox.TextWrapping  = TextWrapping.NoWrap;
         ValueTextBox.AcceptsReturn = false;
     }
     winTitle.Content  = title;
     MessageLabel.Text = message;
     ValueTextBox.Text = Value;
     ValueTextBox.Focus();
 }
コード例 #5
0
ファイル: ValueEditor.cs プロジェクト: TianChun525/RSImage
 //ValuesListView的SelectedIndexChanged事件
 private void StartEdit(object sender, EventArgs e)
 {
     try
     {
         if (ValuesListView.SelectedItems.Count > 0)
         {
             BandTextBox.Text  = "Band " + (ValuesListView.SelectedIndices[0] + 1).ToString();
             ValueTextBox.Text = BandValues[ValuesListView.SelectedIndices[0]].ToString("0.000000");
             CurrentBand       = ValuesListView.SelectedIndices[0];
             ValueTextBox.Focus();
             ValueTextBox.SelectAll();
         }
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
コード例 #6
0
ファイル: EditDialog.cs プロジェクト: lulzzz/PQDIFExplorer
        // Initializes the edit dialog to set the value of the given element.
        public void Initialize(Element element)
        {
            if ((object)element == null)
            {
                return;
            }

            Tag tag = GSF.PQDIF.Tag.GetTag(element.TagOfElement);

            // Determine whether the tag definition contains
            // a list of identifiers which can be used to
            // display the value in a more readable format
            IReadOnlyCollection <Identifier> identifiers = tag?.ValidIdentifiers ?? new List <Identifier>();

            // Some identifier collections define a set of bitfields which can be
            // combined to represent a collection of states rather than a single value
            // and these are identified by the values being represented in hexadecimal
            List <Identifier> bitFields = identifiers.Where(id => id.Value.StartsWith("0x")).ToList();

            if (bitFields.Count > 0)
            {
                // Get the value of the element
                uint value = Convert.ToUInt32(((ScalarElement)element).Get());

                // Values with bitfields will be displayed in a checked list box
                ValueCheckedListBox.Visible = true;
                ValueCheckedListBox.Focus();

                // Populate the checked list box with the valid bitfields
                foreach (Identifier bitField in bitFields)
                {
                    uint bit = Convert.ToUInt32(bitField.Value, 16);
                    ValueCheckedListBox.Items.Add(bitField.Name, (value & bit) > 0u);
                }

                // Set up the function to get the value entered by the user
                m_getValue = () => "{ " + string.Join(", ", ValueCheckedListBox.CheckedItems.Cast <string>()) + " }";
            }
            else if (identifiers.Count > 0)
            {
                // Get the value of the element
                string value = ((ScalarElement)element).Get().ToString();

                // Values with IDs will be displayed in a regular list box
                ValueListBox.Visible = true;
                ValueListBox.Focus();

                // Populate the list box with the valid identifiers
                foreach (Identifier identifier in identifiers.OrderBy(identifier => identifier.Name))
                {
                    ValueListBox.Items.Add(identifier.Name);

                    if (value == identifier.Value)
                    {
                        ValueListBox.SelectedIndex = ValueListBox.Items.Count - 1;
                    }
                }

                // Set up the function to get the value entered by the user
                m_getValue = () => ValueListBox.SelectedItem?.ToString();
            }
            else
            {
                // All other values will be displayed in an editable text box
                ValueTextBox.Visible = true;
                ValueTextBox.Focus();
                ValueTextBox.Text = element.ValueAsString();

                // Set up the function to get the value entered by the user
                m_getValue = () => ValueTextBox.Text;
            }
        }