Exemplo n.º 1
0
 private void Render()
 {
     inputBoxes.Clear();
     RenderLineInputGroups();
     RenderMultiLineInputGroups();
     MultiLineContainer.Loaded += (e, c) =>
     {
         MultiLineBorder.Visibility = Visibility.Collapsed;
         OnRenderDone?.Invoke(this, null);
     };
     BindingActionResults();
     UpdateVariableAction();
     if (ActionContainer != null)
     {
         ActionContainer.ItemIndexChanged += ActionContainer_ItemIndexChanged;
     }
     RenderGlobalVariable();
     //添加操作结果变量
     AddActionResultBtn.Click += (e, c) =>
     {
         if (VariableActionComboBox.SelectedItem != null && VariableActionResultsComboBox.SelectedItem != null)
         {
             var action   = VariableActionComboBox.SelectedItem as ComBoxModel;
             var variable = VariableActionResultsComboBox.SelectedItem as ComBoxModel;
             KeyboradFocusInputBox.AppendText($"{{{action.ID}.{variable.ID}}}");
         }
     };
     //渲染事件变量
     RenderEventVariable();
     //验证输入
     Valid();
 }
Exemplo n.º 2
0
 private void OnKeyPadCLick(object sender, EventArgs e)
 {
     if (sender is Button)
     {
         Button bt = sender as Button;
         InputBox.AppendText(bt.Text);
     }
 }
Exemplo n.º 3
0
        private void ComputationButton_Click(object sender, RoutedEventArgs e)
        {
            string computedText = FormatOutputText();

            this.InputBox.Text = String.Empty;
            if (PrintToScreenRadio.IsChecked == true)
            {
                //this.InputBox.Text = String.Empty;
                InputBox.AppendText(computedText);
            }
            else
            {
                if (PrintToFileRadio.IsChecked == true && FilePath.Text == "Filepath" || String.IsNullOrEmpty(FilePath.Text))
                {
                    System.Windows.MessageBox.Show("Print to file chosen, but no file path was given", "Alert", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    File.WriteAllText(FilePath.Text, computedText);
                }
            }
        }
Exemplo n.º 4
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Open the openfile dialog
            if (openFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            byte[] bytes = File.ReadAllBytes(openFileDialog1.FileName);


            if (openFileDialog1.FileName.Contains(".txt"))
            {
                InputBox.Text = Encoding.ASCII.GetString(bytes);
            }
            else
            {
                if (MovesetTab.Visible)
                {
                    string output = bytes.Aggregate("", (current, t) => current + $"{t:X2}");

                    InputBox.AppendText(output);
                }
                else
                {
                    int   value        = 0;
                    int   multiplicity = 3;
                    int   index        = 0;
                    int[] values       = new int[13];

                    for (int i = 0; i < bytes.Length; i++)
                    {
                        //Skip the rows of F
                        if (i == 0x1C)
                        {
                            i = 0x20;
                        }

                        if (multiplicity == -1)
                        {
                            values[index] = value;
                            value         = 0;
                            index++;
                            multiplicity = 3;
                        }

                        value += bytes[i] << (multiplicity * 8);
                        multiplicity--;
                    }

                    string[] valueStrings = values.Select(s => s.ToString()).ToArray();

                    //There's probably a better way of doing this
                    (ActionIdBox.Text, DamageThrowDataBox.Text, AngleThrowDataBox.Text, KBSThrowDataBox.Text,
                     FKBThrowDataBox.Text,
                     BKBThrowDataBox.Text, DamageEffectThrowBox.Text, DamageReleaseDataBox.Text,
                     AngleReleaseDataBox.Text, KBSReleaseDataBox.Text,
                     FKBReleaseDataBox.Text, BKBReleaseDataBox.Text, DamageEffectReleaseBox.Text) = (valueStrings[0],
                                                                                                     valueStrings[1], valueStrings[2], valueStrings[3], valueStrings[4], valueStrings[5],
                                                                                                     valueStrings[6], valueStrings[7], valueStrings[8], valueStrings[9], valueStrings[10],
                                                                                                     valueStrings[11], valueStrings[12]);
                }
            }
        }