예제 #1
0
 public CETableItemEditor(CETableItem cETableItem) : this()
 {
     if (cETableItem.Address.Offsets.Count > 0)
     {
         CBPointer.IsChecked = true;
         RectBorder.Height   = 255;
         Height = 255;
         GridOffset.Visibility = Visibility.Visible;
     }
     TBAddress.Text = cETableItem.Address.BaseAddress.ToString("X8");
     for (int i = 0; i < cETableItem.Address.Offsets.Count; i++)
     {
         int item = cETableItem.Address.Offsets[i];
         if (i == 0)
         {
             GridOffset.Children.OfType <TextBox>().Last().Text = item.ToString("X8");
         }
         else
         {
             AddOffset().Text = item.ToString("X8");
         }
     }
     TBDescription.Text   = cETableItem.Description;
     CBType.SelectedIndex = (int)cETableItem.DataType;
 }
예제 #2
0
 public InputDialog(CETableItem cETableItem)
 {
     InitializeComponent();
     this.cETableItem = cETableItem;
     TBTitle.Text    += cETableItem.Address.GetAddress();
     TBContent.Text   = cETableItem.DataValue.ToString();
     TBContent.Focus();
     TBContent.SelectAll();
 }
예제 #3
0
 public InputDialog(CETableItem ceTableItem)
 {
     InitializeComponent();
     this.cETableItem = ceTableItem;
     TBTitle.Text     = (Lang.IsChinese ? "修改地址" : "Change value at...") + ceTableItem.Address.GetAddress();
     TBContent.Text   = ceTableItem.DataValue.ToString();
     TBContent.Focus();
     TBContent.SelectAll();
 }
예제 #4
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            int address;

            try
            {
                address = ExpressionEval.Parse(TBAddress.Text);
            }
            catch
            {
                CETableItem  = null;
                TBValue.Text = "0";
                return;
            }
            if (CBPointer.IsChecked == false)
            {
                OffsetAddress offsetAddress = new OffsetAddress(address);
                CETableItem             = new CETableItem(offsetAddress, (DataType)CBType.SelectedIndex);
                CETableItem.Description = TBDescription.Text;
                TBValue.Text            = CETableItem.DataValue.ToString();
            }
            else
            {
                try
                {
                    OffsetAddress offsetAddress = new OffsetAddress(address, GridOffset.Children.OfType <TextBox>().Select(tb => ExpressionEval.Parse(tb.Text)).ToArray());
                    CETableItem             = new CETableItem(offsetAddress, (DataType)CBType.SelectedIndex);
                    CETableItem.Description = TBDescription.Text;
                    TBValue.Text            = CETableItem.DataValue.ToString();
                }
                catch
                {
                    CETableItem  = null;
                    TBValue.Text = "0";
                    return;
                }
            }
        }