Exemple #1
0
 private void buttonUpdateC64_Click(object sender, RoutedEventArgs e)
 {
     foreach (int key in mTagToSubComponent.Keys)
     {
         TweakPanelSubComponent sub = mTagToSubComponent[key][0];
         sub.updateC64(mMW);
     }
 }
Exemple #2
0
        private void buttonRebuildControls_Click(object sender, RoutedEventArgs e)
        {
            string format = mScript.Text;

            string[] parts = format.Split(';');
            mTagToSubComponent = new MultiMap <int, TweakPanelSubComponent>();
            mDynamic.Children.Clear();
            int tag = 1;

            mMW.TestForMemoryDump(true); // make sure everything is up to date

            try
            {
                foreach (string part in parts)
                {
                    string[] commParts = part.Split(':');
                    string   address   = commParts[0].Trim();
                    if (address.StartsWith("$"))
                    {
                        address = address.Substring(1); //remove $
                    }
                    string type = commParts[1].Trim().ToLower();
                    TweakPanelSubComponent.eDisplayType displayType = TweakPanelSubComponent.eDisplayType.Decimal;
                    TweakPanelSubComponent.eWidth       width       = TweakPanelSubComponent.eWidth.Byte;
                    switch (type[0])
                    {
                    case 'd':     //decimal
                        displayType = TweakPanelSubComponent.eDisplayType.Decimal;
                        break;

                    case 'h':     //hex
                        displayType = TweakPanelSubComponent.eDisplayType.Hex;
                        break;

                    default:
                        break;
                    }

                    switch (type[1])
                    {
                    case 'b':     //byte
                        width = TweakPanelSubComponent.eWidth.Byte;
                        break;

                    case 'w':     //word
                        width = TweakPanelSubComponent.eWidth.Word;
                        break;

                    default:
                        break;
                    }

                    Label lab = new Label();
                    lab.Content = address;
                    TextBox tb = new TextBox();
                    tb.Text = "dummy";
                    tb.Tag  = tag;
                    StackPanel sp = new StackPanel();
                    sp.Orientation = Orientation.Horizontal;
                    sp.Children.Add(lab);
                    sp.Children.Add(tb);

                    mDynamic.Children.Add(sp);

                    int address_int = 64 * 1024 + 1;
                    Int32.TryParse(address, System.Globalization.NumberStyles.HexNumber, CultureInfo.InvariantCulture, out address_int);

                    TweakPanelSubComponent sub = new TweakPanelSubComponent(displayType, width, address_int, tag, tb);
                    sub.setFromValue(mMW);
                    mTagToSubComponent.Add(tag, sub);
                    tag += 1;
                }
            }
            catch (Exception /*e*/)
            {
                MessageBox.Show("invalid desc string");
            }
        }