Ejemplo n.º 1
0
 public MoveControl(StringArgs args)
 {
     InitializeComponent();
     myargs = args as MoveArgs;
     Move_Start_TextBox.Text = myargs.Start.ToString();
     Move_End_TextBox.Text   = myargs.End.ToString();
 }
 public MoveConfigDialog(StringArgs args)
 {
     InitializeComponent();
     //Lấy thông tin cũ hiện lên dialog
     myArgs           = args as MoveArgs;
     sizeTextBox.Text = myArgs.Size.ToString();
 }
Ejemplo n.º 3
0
 public MoveOperation()
 {
     Args = new MoveArgs()
     {
         Mode   = "Front",
         Number = 0
     };
 }
        public MoveOperationDialog(StringArgs Arguments)
        {
            InitializeComponent();
            MoveArgs args = Arguments as MoveArgs;

            Num.Text = args.Number.ToString();
            if (args.Mode == "Front")
            {
                RadioButton1.IsChecked = true;
            }
            else
            {
                RadioButton2.IsChecked = true;
            }
        }
Ejemplo n.º 5
0
        private void btnSavePreset_Click(object sender, RoutedEventArgs e)
        {
            var screen = new FillinFileNameDialog();

            if (screen.ShowDialog() == true)
            {
                var filename = screen.FileName + ".txt";
                var writer   = new StreamWriter(filename);

                foreach (StringOperation action in ActionListBox.Items)
                {
                    switch (action.Name)
                    {
                    case "Replace":
                    {
                        ReplaceArgs temp = action.Args as ReplaceArgs;
                        writer.WriteLine($"{action.Name}|{temp.From}|{temp.To}");
                        break;
                    }

                    case "NewCase":
                    {
                        NewCaseArgs temp = action.Args as NewCaseArgs;
                        writer.WriteLine($"{action.Name}|{temp.From}");
                        break;
                    }

                    case "Fullname Normalize":
                    {
                        FullnameNormalizeArgs temp = action.Args as FullnameNormalizeArgs;
                        writer.WriteLine($"{action.Name}|{temp.From}");
                        break;
                    }

                    case "Move":
                    {
                        MoveArgs temp = action.Args as MoveArgs;
                        writer.WriteLine($"{action.Name}|{temp.From}");
                        break;
                    }
                    }
                }
                writer.Close();
                loadPresetFile();
            }
        }
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            MoveArgs result = new MoveArgs();

            result.Number = int.Parse(Num.Text);
            if (RadioButton1.IsChecked == true)
            {
                result.Mode = RadioButton1.Content.ToString();
            }
            else
            {
                result.Mode = RadioButton2.Content.ToString();
            }
            if (StringArgsChange != null)
            {
                StringArgsChange.Invoke(result);
            }
            DialogResult = true;
            Close();
        }
Ejemplo n.º 7
0
        private void Save_ListAction_Button_Click(object sender, RoutedEventArgs e)
        {
            // save file dialog
            System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog()
            {
                Title            = "Save text Files",
                CheckPathExists  = true,
                DefaultExt       = "txt",
                Filter           = "Text files (*.txt)|*.txt|All files (*.*)|*.*",
                FilterIndex      = 2,
                RestoreDirectory = true,
            };

            // get filename
            string filename = "";

            if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                filename = saveFileDialog.FileName;


                var writer = new StreamWriter(filename);
                // Dong dau tien la luot di hien tai

                foreach (var item in _actions)
                {
                    string mySaveArgs = "";
                    string args       = item.Args.ToString();

                    //args.CompareTo(Replace) == 1
                    if (args == Replace)
                    {
                        ReplaceArgs saveargs = item.Args as ReplaceArgs;
                        mySaveArgs = Replace + " From:" + saveargs.From + " To:" + saveargs.To + " " + saveargs.ReplaceName.ToString();
                        writer.WriteLine(mySaveArgs);
                    }
                    if (args == Move)
                    {
                        MoveArgs saveargs = item.Args as MoveArgs;
                        mySaveArgs = Move + " " + saveargs.Start + " " + saveargs.End + " " + saveargs.Before.ToString();
                        writer.WriteLine(mySaveArgs);
                    }
                    if (args == Newcase)
                    {
                        NewCaseArgs saveargs = item.Args as NewCaseArgs;
                        mySaveArgs = Newcase + " " + saveargs.optionNewCase.ToString();
                        writer.WriteLine(mySaveArgs);
                    }
                    if (args == Unique)
                    {
                        UniqueNameArgs saveargs = item.Args as UniqueNameArgs;
                        mySaveArgs = Unique;
                        writer.WriteLine(mySaveArgs);
                    }
                    if (args == Normalize)
                    {
                        FullnameNormalizeArg saveargs = item.Args as FullnameNormalizeArg;
                        mySaveArgs = Normalize;
                        writer.WriteLine(mySaveArgs);
                    }
                }
                writer.Close();
            }
        }
Ejemplo n.º 8
0
 public MoveDialog(MoveArgs args)
 {
     InitializeComponent();
     args.From = From;
 }
Ejemplo n.º 9
0
 void ChangeMoveArgs(MoveArgs ChangedArgs)
 {
     Args = ChangedArgs;
 }