예제 #1
0
        private void CmdList_Load_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Ask for file to load
            dlg.Filter = "C Files|*.c";
            dlg.Title = "Select the strategy file (A=Red, B=Purple)";
            dlg.CheckFileExists = true;
            dlg.ShowDialog();
            _CurrentStrategyFilename = dlg.FileName.ToString();

            if (_CurrentStrategyFilename != "")
            {
                // Ask for file to load
                dlg.Filter = "Pattern Files|*.pattern";
                dlg.Title = "Select the pattern strategy file (A=Red, B=Purple)";
                dlg.CheckFileExists = true;
                dlg.ShowDialog();
                _CurrentStrategyPatternFilename = dlg.FileName.ToString();

                if (_CurrentStrategyPatternFilename != "")
                {
                    _CurrentStrategy = new FullStrategy(_CurrentStrategyFilename, _CurrentStrategyPatternFilename);
                    LoadNewStrategy();
                }
            }
        }
예제 #2
0
        private void CmdList_New_Click(object sender, RoutedEventArgs e)
        {
            AskStrategyName StrategyName = new AskStrategyName();
            StrategyName.ShowDialog();

            if(StrategyName.StrategyNameTxt.Text != "")
            {
                _CurrentStrategy = new FullStrategy(StrategyName.StrategyNameTxt.Text);
                LoadNewStrategy();
                CmdViewN_isEnabled(true);
            }
        }
예제 #3
0
        private void General_buttonImport_Click(object sender, RoutedEventArgs e)
        {
            String LoopFilename = "";
            String PatternFileName = "";
            FullStrategy LoopsToImport = null;

            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Ask for file to load
            dlg.Filter = "C Files|*.c";
            dlg.Title = "Select the strategy file (A=Red, B=Purple)";
            dlg.CheckFileExists = true;
            dlg.ShowDialog();
            LoopFilename = dlg.FileName.ToString();

            if (LoopFilename != "")
            {
                // Ask for file to load
                dlg.Filter = "Pattern Files|*.pattern";
                dlg.Title = "Select the pattern strategy file (A=Red, B=Purple)";
                dlg.CheckFileExists = true;
                dlg.ShowDialog();
                PatternFileName = dlg.FileName.ToString();

                if (PatternFileName != "")
                {
                    LoopsToImport = new FullStrategy(LoopFilename, PatternFileName);

                    // Check for imported loops
                    if (LoopsToImport != null)
                    {
                        for (int i = 0; i<=LoopsToImport.Count(); i++)
                        {
                            Command CommandToAdd = LoopsToImport.GetCommand(i);
                            int CommandIDToAdd = LoopsToImport.GetActionID(i);
                            int NextCommandIDToAdd = LoopsToImport.GetNextActionID(i);
                            int TimeoutID = LoopsToImport.GetTimeoutID(i);

                            if (CommandIDToAdd >= 100)
                            {
                                _CurrentStrategy.InsertCmd(CommandToAdd, CommandIDToAdd, NextCommandIDToAdd, TimeoutID);
                            }
                        }

                        LoadNewStrategy();
                    }
                }
            }
        }