示例#1
0
        public kadinamain()
        {
            TrackEnabled             = Util.TrackUsage();
            Program                  = PROGRAM;
            _dps                     = "N" + _dp;
            SimBroker.UseBidAskFills = Properties.Settings.Default.UseBidAskFills;
            InitializeComponent();
            initgrids();
            debugControl1.NewCreateTicketEvent += new DebugDelegate(debugControl1_NewCreateTicketEvent);
            sizetabs();
            restorerecentfiles();
            restorerecentlibs();
            restoreskins();
            FormClosing += new FormClosingEventHandler(kadinamain_FormClosing);
            Resize      += new EventHandler(kadinamain_Resize);
            bw.DoWork   += new DoWorkEventHandler(Play);
            bw.WorkerReportsProgress      = false;
            bw.WorkerSupportsCancellation = true;
            bw.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(PlayComplete);

            bw2.DoWork += new DoWorkEventHandler(bw2_DoWork);
            bw2.RunWorkerAsync();
            debug(Util.TLSIdentity());
            debug(RunTracker.CountNewGetPrettyRuns(PROGRAM, Util.PROGRAM));
            // grid errors
            dg.DataError += new DataGridViewDataErrorEventHandler(dg_DataError);
            ig.DataError += new DataGridViewDataErrorEventHandler(ig_DataError);
            fg.DataError += new DataGridViewDataErrorEventHandler(fg_DataError);
            og.DataError += new DataGridViewDataErrorEventHandler(og_DataError);
            pg.DataError += new DataGridViewDataErrorEventHandler(pg_DataError);
        }
示例#2
0
        public Gauntlet()
        {
            TrackEnabled = Util.TrackUsage();
            Program      = PROGRAM;
            InitializeComponent();
            debug(Util.TLSIdentity());
            args.GotDebug += new DebugDelegate(args_GotDebug);
            args.ParseArgs(Environment.GetCommandLineArgs());
            FormClosing += new FormClosingEventHandler(Gauntlet_FormClosing);
            debug(RunTracker.CountNewGetPrettyRuns(PROGRAM, Util.PROGRAM));
            bw.WorkerSupportsCancellation = true;
            bw.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
            getsymwork.WorkerSupportsCancellation = true;
            getsymwork.DoWork             += new DoWorkEventHandler(getsymwork_DoWork);
            getsymwork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(getsymwork_RunWorkerCompleted);
            getsymwork.RunWorkerAsync();
            getsymwork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(getsymwork_RunWorkerCompleted);

            if (args.isUnattended)
            {
                ordersincsv.Checked = true;
                //ShowWindow(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle, SW_MINIMIZE);
                bindresponseevents();
                queuebut_Click(null, null);
            }
            else
            {
                status("wait while tickdata is loaded...");
                UpdateResponses(Util.GetResponseList(args.DllName));
            }
        }
示例#3
0
        public void CanStartAndEndSpecification()
        {
            var sink     = Substitute.For <IExecutionListener>();
            var elements = new ISpecificationElement[]
            {
                ElementFixtures.Specification1,
                ElementFixtures.Behavior1Specification1,
                ElementFixtures.Behavior1Specification2
            };

            var cache   = new ElementCache(elements);
            var tracker = new RunTracker(elements);

            var listener = new ExecutionAdapterRunListener(sink, cache, tracker);

            var context       = new TestContextInfo(ElementFixtures.Context.TypeName, string.Empty);
            var specification = new TestSpecificationInfo(ElementFixtures.Context.TypeName, ElementFixtures.Specification1.FieldName, string.Empty);

            listener.OnContextStart(context);
            listener.OnSpecificationStart(specification);
            listener.OnSpecificationEnd(specification, new TestRunResult(TestStatus.Passing));
            listener.OnContextEnd(context);

            sink.Received().OnContextStart(ElementFixtures.Context);
            sink.Received().OnSpecificationStart(ElementFixtures.Specification1);
            sink.Received().OnSpecificationEnd(ElementFixtures.Specification1, Arg.Any <string>(), Arg.Any <TestRunResult>());
            sink.Received().OnContextEnd(ElementFixtures.Context, Arg.Any <string>());
        }
示例#4
0
        public void CanNotifyRun()
        {
            var sink    = Substitute.For <IExecutionListener>();
            var cache   = new ElementCache(Array.Empty <ISpecificationElement>());
            var tracker = new RunTracker(Array.Empty <ISpecificationElement>());

            var listener = new ExecutionAdapterRunListener(sink, cache, tracker);

            listener.OnRunStart();
            listener.OnRunEnd();

            sink.Received().OnRunStart();
            sink.Received().OnRunEnd();
        }
        public void RunType()
        {
            string task;

            do
            {
                Console.WriteLine("Let's start?(yes/no):");
                task = Console.ReadLine();
                if (task == "yes")
                {
                    Stopwatch stopWatch = new Stopwatch();
                    stopWatch.Start();
                    double d = 0;
                    for (int i = 0; i < 1000 * 1000 * 1000; i++)
                    {
                        d += 1;
                    }
                    Console.WriteLine("Enter 1 to stop:");
                    int.TryParse(Console.ReadLine(), out int userInput);
                    switch (userInput)
                    {
                    case 1:
                    {
                        stopWatch.Stop();
                        var speed   = new Random().Next(0, 30);
                        var workout = new RunTracker {
                            TimeWorkout = stopWatch.Elapsed, Distance = speed * stopWatch.Elapsed.TotalSeconds / 60
                        };
                        run.Add(workout);

                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("Running time: {0:hh\\:mm\\:ss\\.fffffff}", stopWatch.Elapsed);
                        Console.ResetColor();

                        Random        rnd = new Random();
                        Enums.RunType n   = (Enums.RunType)rnd.Next(3);
                        Console.WriteLine(n);
                    }
                    break;
                    }
                }
            }while (task != "no");
            foreach (var training in run)
            {
                Console.WriteLine($"Time {training.TimeWorkout} distance {training.Distance}");
            }
            Console.ReadKey();
        }
        void initializeSim()
        {
            _backgroundWorker    = new BackgroundWorker();
            _historicalSimulator = new MultiSimImpl();
            _broker = new Broker();
            //_resultsModel = new ResultsModel();

            _broker.UseBidAskFills    = _useBidAskFills;
            _backgroundWorker.DoWork += play;
            _backgroundWorker.WorkerReportsProgress      = false;
            _backgroundWorker.WorkerSupportsCancellation = true;
            _backgroundWorker.RunWorkerCompleted        += PlayComplete;

            debug(Util.TLSIdentity());
            debug(RunTracker.CountNewGetPrettyRuns(_programName, Util.PROGRAM));
        }
示例#7
0
        public void CanNotifyAssembly()
        {
            const string path = "path/to/assembly.dll";

            var sink    = Substitute.For <IExecutionListener>();
            var cache   = new ElementCache(Array.Empty <ISpecificationElement>());
            var tracker = new RunTracker(Array.Empty <ISpecificationElement>());

            var listener = new ExecutionAdapterRunListener(sink, cache, tracker);

            var assembly = new TestAssemblyInfo(path);

            listener.OnAssemblyStart(assembly);
            listener.OnAssemblyEnd(assembly);

            sink.Received().OnAssemblyStart(path);
            sink.Received().OnAssemblyEnd(path);
        }
示例#8
0
        public Gauntlet()
        {
            TrackEnabled = Util.TrackUsage();
            Program      = PROGRAM;
            InitializeComponent();
            Text += " " + Util.TLVersion();
            debug(Util.TLSIdentity());
            args.GotDebug += new DebugDelegate(args_GotDebug);
            args.ParseArgs(Environment.GetCommandLineArgs());
            FormClosing += new FormClosingEventHandler(Gauntlet_FormClosing);
            debug(RunTracker.CountNewGetPrettyRuns(PROGRAM, Util.PROGRAM));
            bw.WorkerSupportsCancellation = true;
            bw.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
            getsymwork.WorkerSupportsCancellation = true;
            getsymwork.DoWork             += new DoWorkEventHandler(getsymwork_DoWork);
            getsymwork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(getsymwork_RunWorkerCompleted);
            getsymwork.RunWorkerAsync();
            getsymwork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(getsymwork_RunWorkerCompleted);

            if (args.isUnattended)
            {
                ordersincsv.Checked = true;
                if (args.HideWindow)
                {
                    this.ShowInTaskbar = false; this.WindowState = FormWindowState.Minimized;
                }
                //ShowWindow(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle, SW_MINIMIZE);
                bindresponseevents();
                queuebut_Click(null, null);
            }
            else
            {
                status("wait while tickdata is loaded...");
                UpdateResponses(ResponseLoader.GetResponseList(args.DllName));
            }

            _optdecision.Items.Clear();
            _optdecision.Items.AddRange(Optimize.GetDecideable().ToArray());
            if (_optdecision.Items.Count > 0)
            {
                _optdecision.Text = "NetPL";
            }
        }