Exemple #1
0
        private static void Main()
        {
            //var process = Process.GetProcessesByName("telegram").Single(x => x.MainWindowHandle != IntPtr.Zero);
            var window = new OverlayWindow(0, 0, 1920, 1080, true)
            {
                FramesPerSecond = 5000
            };

            window.OnDraw += Overlay_OnDraw;

            GenerateCircles(window);

            void UpdateCircles()
            {
                foreach (var circle in Circles)
                {
                    circle.Update(window.Width, window.Height);
                }
            }

            for (int i = 0; i < 180; i++)
            {
                RunHelper.ConsistentRun(UpdateCircles, 16);
            }

            window.Dispose();

            Console.ReadKey(true);
        }
Exemple #2
0
        public void Search(string query, SearchOptionParameter optionParameter, bool force = false)
        {
            ResultIllusts.Clear();
            ResultNovels.Clear();
            ResultUsers.Clear();
            _query       = query;
            _offset      = "";
            _count       = 0;
            _optionParam = optionParameter;
            if (!string.IsNullOrWhiteSpace(_optionParam.EitherWord))
            {
                _query += " " + string.Join(" ", _optionParam.EitherWord.Split(' ').Select(w => $"({w})"));
            }
            if (!string.IsNullOrWhiteSpace(_optionParam.IgnoreWord))
            {
                _query += " " + string.Join(" ", _optionParam.IgnoreWord.Split(' ').Select(w => $"--{w}"));
            }
#if !OFFLINE
            HasMoreItems = true;
            if (force)
            {
                RunHelper.RunAsync(SearchAsync);
            }
#endif
        }
Exemple #3
0
        public bool Start()
        {
            //ensure everything is ready to start the optimization
            if (!isValid)
            {
                debug("Invalid optimization, Must configure this optimization completely before re-starting.");
                status("Optimization not configured.");
                return(false);
            }
            SIM   = myhistsim;
            DLL   = Dll;
            RNAME = ResponseName;

            debug("Starting optimization, Queueing up all " + this.OptimizeCount + " combinations...");

            //queue up all the possibilities

            /*
             * List<List<string[]>> paramListList = new List<List<string[]>>();
             * foreach (OptimizationParam op in varListControl.Items)
             * {
             *  List<string[]> paramList = new List<string[]>();
             *  string testClass = (String)reslist.SelectedItem;
             *  string testName = op.name.ToString();
             *  decimal val = decimal.MinValue;
             *  decimal max = decimal.MaxValue;
             *  while (val < max)
             *  {
             *      if (val == decimal.MinValue) { val = op.low; max = op.high; }
             *      else val += op.step;
             *      paramList.Add(new string[] { testClass, testName, val.ToString() });
             *  }
             *  paramListList.Add(paramList);
             * }
             *
             * //now we have all the possibilities in a list
             * //we need to combine them into all possible combos
             *
             * //keep all possible combinations in a list
             * //each string[] is a parameter value
             * //each List<string[]> is a parameter set
             * List<List<string[]>> comboList = new List<List<string[]>>();
             *
             * foreach (List<string[]> paramList in paramListList)
             * {
             *  comboList = appendList(comboList, paramList);
             * }*/

            debug("All combinations queued, Starting Gauntlet Threads");


            var rh = RunHelper.run(runopt, null, debug, "runopt: " + this.ToString());

            status("Optimizaton started with " + OptimizeCount + " combinations.");
            return(rh.isStarted);
        }
 public void ForcePush()
 {
     if (_illustIds.Count >= 1)
     {
         RunHelper.RunAsync(SendAsync, true);
     }
     if (_novelIds.Count >= 1)
     {
         RunHelper.RunAsync(SendAsync, false);
     }
 }
 public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
 {
     base.OnNavigatedTo(e, viewModelState);
     if (_accountService.IsLoggedIn)
     {
         Initialize();
     }
     else
     {
         RunHelper.RunLaterUI(RedirectToLoginPage, TimeSpan.FromMilliseconds(10));
     }
 }
 public void Add(INovel novel)
 {
     if (_novelIds.Contains(novel.Id))
     {
         return;
     }
     _novelIds.Add(novel.Id);
     if (_novelIds.Count >= 5)
     {
         RunHelper.RunAsync(SendAsync, false);
     }
 }
 public void Add(IIllust illust)
 {
     if (_illustIds.Contains(illust.Id))
     {
         return;
     }
     _illustIds.Add(illust.Id);
     if (_illustIds.Count >= 5)
     {
         RunHelper.RunAsync(SendAsync, true);
     }
 }
Exemple #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sym = chartsymbolbox.Text.ToUpper();

            chartsymbolbox.Text = sym;
            usecachenow         = usecachebut.Checked;
            useblack            = blackbackground.Checked;
            usesticky           = stickychartsbox.Checked;
            usemax = maxchartbox.Checked;
            newchartsyms.Write(sym);
            RunHelper.run(downloaddata, null, debug, "chartographer background fetcher");
        }
        public IHttpActionResult CountPoint()
        {
            try
            {
                Stream       postData    = HttpContext.Current.Request.InputStream;
                StreamReader sRead       = new StreamReader(postData);
                string       postContent = sRead.ReadToEnd();
                sRead.Close();

                int PlayScore = 0;

                List <Points> runModel = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Points> >(postContent);
                double        Dis      = 0;

                if (runModel != null && runModel.Count() > 1)
                {
                    for (int i = 0; i < runModel.Count() - 1; i++)
                    {
                        double d = RunHelper.GetDistance(runModel[i].latitude, runModel[i].longitude, runModel[i + 1].latitude, runModel[i + 1].longitude);


                        long FTime = runModel[i].pointTimestamp;
                        long STime = runModel[i + 1].pointTimestamp;

                        double cha = (STime - FTime) / 1000;

                        double speed = (d / cha);



                        if (speed < 0.5 || speed > 7)
                        {
                        }
                        else
                        {
                            Dis = Dis + d;
                        }
                    }
                    return(Json(new { R = true, Data = (Dis / 1000).ToString("0.000") }));
                }
                else
                {
                    return(Json(new { R = true, Data = 0 }));
                }
            }
            catch (Exception ex)
            {
                Edu.Tools.LogHelper.Info(ex.ToString());

                return(Json(new { R = true, Data = 0 }));
            }
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);
            var parameter = ParameterBase.ToObject <FollowingParameter>((string)e.Parameter);

            if (_accountService.IsLoggedIn)
            {
                Initialize(parameter);
            }
            else
            {
                RunHelper.RunLaterUI(RedirectToLoginPage, parameter, TimeSpan.FromMilliseconds(10));
            }
        }
Exemple #11
0
        public void RunCondeceptjsDefault()
        {
            var dir = LogApplication.Agent.GetCurrentDir();

            dir = dir.Replace("file:\\", string.Empty);
            string drive       = Path.GetPathRoot(dir);
            string driveLetter = drive.First().ToString();

            //var param = string.Format("cd /{0} {1}\\CodeceptJs\\Project2", driveLetter, dir);
            var param = string.Format("cd {1}\\CodeceptJs\\Project2", driveLetter, dir);

            //MyConsoleControlForChrome.WriteInput("node LaunchChromeExt.js", Color.AliceBlue, true);
            var batFolder   = string.Format("{0}\\Bat", dir); //@"D:\_ROBOtFRAMeWORK\CodeceptsJs\Project1\";
            var batPath     = Path.Combine(batFolder, "RunCodeceptjs.bat");
            var batTemplate = File.ReadAllText(batPath);

            batTemplate = batTemplate.Replace("##Home##", param);
            var codeceptjsFolder = string.Format("{0}\\CodeceptJs\\Project2", dir);  //@"D:\_ROBOtFRAMeWORK\CodeceptsJs\Project1\";
            var codeceptBatPath  = Path.Combine(codeceptjsFolder, "RunCodeceptjs.bat");

            for (int i = 0; i < 10; i++)
            {
                codeceptBatPath = Path.Combine(codeceptjsFolder, "RunCodeceptjs" + i.ToString() + ".bat");

                if (File.Exists(codeceptBatPath))
                {
                    try
                    {
                        File.Delete(codeceptBatPath);
                        File.WriteAllText(codeceptBatPath, batTemplate);
                        break;
                    }
                    catch (Exception)
                    {
                        //  throw;
                    }
                }
                else
                {
                    File.WriteAllText(codeceptBatPath, batTemplate);
                    break;
                }
            }
            //step# 2 run bat file
            CmdExeForCodecept = RunHelper.ExecuteCommand(codeceptBatPath);
            return;
        }
Exemple #12
0
        public void ThenSubmitTheFollowingTestsToBeProcessed(string dllName, Table table)
        {
            List <TestModel> tests = new List <TestModel>();
            var config             = Common.SetConfigFromLocalAppConfig();

            config.RemoteHub       = "http://hub.browserstack.com/wd/hub/";
            config.RemoteWebDriver = "browserstack";
            config.RemoteUserName  = "******";
            config.RemoteAccessKey = "";
            config.RemoteProxyHost = "";
            config.RemoteProxyPort = "3128";
            config.ResultsPath     = @"c:\inetpub\Testing\Results\";
            config.TestToolsFolder = @"C:\inetpub\Testing\Tools\";
            config.TestAssembly    = string.Format(@"c:\inetpub\testing\{0}\bin\{0}.dll", dllName, dllName);

            foreach (var row in table.Rows)
            {
                var newConfig = JsonConvert.DeserializeObject <ConfigModel>(JsonConvert.SerializeObject(config));
                foreach (var category in row["tags"].Split(new [] { "," }, StringSplitOptions.RemoveEmptyEntries))
                {
                    newConfig.Environment    = row["Environment"];
                    newConfig.Browser        = row["Browser"];
                    newConfig.BrowserVersion = row["BrowserVersion"];
                    newConfig.Version        = row["BrowserVersion"];
                    newConfig.Platform       = row["Platform"];

                    var newModel = new TestModel()
                    {
                        Category    = category,
                        Type        = "category",
                        ConfigModel = newConfig
                    };

                    tests.Add(newModel);
                }
            }

            RunHelper runner = new RunHelper();


            runner.SubmitTestsAsCatagories(tests);
        }
        public QuotopiaMain()
        {
            InitializeComponent();
            if (!isquotopiacountok())
            {
                return;
            }
            // handle close smoothly
            FormClosing += new FormClosingEventHandler(QuotopiaMain_FormClosing);

            // initialization
            initquotopiachrome();
            initgvs();
            initfeeds();
            split.SplitterMoved += new SplitterEventHandler(split_SplitterMoved);
            Resize += new EventHandler(QuotopiaMain_Resize);


            restoresettings();
            setsplitter();
            RunHelper.run(refreshviews, completenone, debug, "refreshview");
        }
 private void AddEventHandler()
 {
     if (RootFrame != null)
     {
         RootFrame.Navigating += RootFrameOnNavigating;
         _disposable           = Observable.Interval(TimeSpan.FromMilliseconds(100))
                                 .ObserveOnUIDispatcher()
                                 .Where(w => CategoryService.UpdateRequired)
                                 .Subscribe(w =>
         {
             AssociatedObject.SelectionChanged -= OnSelectionChanged;
             if (CategoryService.Index >= 0)
             {
                 AssociatedObject.SelectedIndex = CategoryService.Index;
             }
             SetTitle(CategoryService.Name);
             AssociatedObject.SelectionChanged += OnSelectionChanged;
         });
         return;
     }
     RunHelper.RunLaterUI(AddEventHandler, TimeSpan.FromMilliseconds(100));
 }
        private void Initialize()
        {
            _categoryService.UpdateCategory();
            _browsingHistoryService.Add(_novel);
            Title         = _novel.Title;
            ConvertValues = new List <object> {
                _novel.Caption, _navigationService
            };
            CreatedAt     = _novel.CreateDate.ToString("g");
            Username      = _novel.User.Name;
            View          = _novel.TotalView;
            BookmarkCount = _novel.TotalBookmarks;
            IsBookmarked  = _novel.IsBookmarked;
            TextLength    = $"{_novel.TextLength.ToString("##,###")}文字";
            _novel.Tags.ForEach(w => Tags.Add(new PixivTagViewModel(w, _navigationService)));
            Thumbnailable = new PixivNovel(_novel, _imageStoreService);
            _pixivUser    = new PixivUserImage(_novel.User, _imageStoreService);
            _pixivUser.ObserveProperty(w => w.ThumbnailPath)
            .Where(w => !string.IsNullOrWhiteSpace(w))
            .ObserveOnUIDispatcher()
            .Subscribe(w => IconPath = w)
            .AddTo(this);
            _pixivComment = new PixivComment(_novel, _pixivClient, _queryCacheService);
            _pixivComment.Comments.ObserveAddChanged()
            .Where(w => ++ _count <= 5)
            .Select(CreatePixivComment)
            .ObserveOnUIDispatcher()
            .Subscribe(w => Comments.Add(w))
            .AddTo(this);
#if !OFFLINE
            if (IconPath == PyxisConstants.DummyIcon)
            {
                RunHelper.RunLaterUI(_pixivUser.ShowThumbnail, TimeSpan.FromMilliseconds(100));
            }
#endif
        }
Exemple #16
0
 public void Fetch() => RunHelper.RunAsync(FetchTrendingTags);
Exemple #17
0
 public QueryCache()
 {
     IsEnabled = true;
     RunHelper.RunLater(() => IsEnabled = false, TimeSpan.FromMinutes(5));
 }
Exemple #18
0
 public void Fetch() => RunHelper.RunAsync(FetchComments);
Exemple #19
0
 public void FetchAll() => RunHelper.RunAsync(FetchRanking);
Exemple #20
0
 public LocalLicenseService()
 {
     _licenseInformation = CurrentAppSimulator.LicenseInformation;
     RunHelper.RunAsync(LocalLicenseServiceCtor);
 }
 protected override void OnAttached()
 {
     base.OnAttached();
     AssociatedObject.SelectionChanged += OnSelectionChanged;
     RunHelper.RunLaterUI(AddEventHandler, TimeSpan.FromMilliseconds(500));
 }
    public void ExecutableRunsSuccessfully()
    {
        var output = RunHelper.RunExecutable(TestResult.AssemblyPath);

        Assert.AreEqual("Run-OK", output);
    }
Exemple #23
0
 public override void ShowThumbnail() => RunHelper.RunAsync(DownloadImage);
Exemple #24
0
 public void Fetch() => RunHelper.RunAsync(FetchText);
Exemple #25
0
 public void Fetch() => RunHelper.RunAsync(FetchAsync);
        private void _inputbut_Click(object sender, EventArgs e)
        {
            // make sure we only convert one group at a time
            if (bw.IsBusy || isgenericbusy)
            {
                debug("wait until conversion completes..."); return;
            }
            // see if we're converting from files or webservices
            switch (_conval)
            {
            case Converter.GenericCSV:
            {
                // prompt
                GenericConvert gc = new GenericConvert();
                gc.SendDebugEvent += new DebugDelegate(debug);
                if (gc.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (gc.isConvertOk)
                    {
                        // reset progress
                        progress(0);
                        // get map
                        genericcsv = gc.CurrentMap;
                        // start process
                        RunHelper.run(dogenericconvert, null, debug, "generic convert start");
                    }
                }
                else
                {
                    debug("user canceled generic csv convert.");
                }
                return;
            }

            // webservice list
            case Converter.EuronextDaily:
            case Converter.YahooDaily:
            case Converter.GoogleDaily:
                // reset progress
                progress(0);
                // get list of symbols from user
                string symi = Microsoft.VisualBasic.Interaction.InputBox("Enter list of symbols to pull from " + _conval.ToString() + Environment.NewLine + "(eg LVS,GOOG,GE)", "Enter symbol list", string.Empty, 0, 0);
                // remove spaces and capitalize
                symi = symi.Replace(" ", string.Empty).ToUpper();
                // parse
                string[] syms  = symi.Split(',');
                int      count = 0;
                foreach (string sym in syms)
                {
                    try
                    {
                        // get barlists for those symbols
                        BarList bl;
                        if (_conval == Converter.GoogleDaily)
                        {
                            bl = BarListImpl.DayFromGoogle(sym);
                        }
                        else if (_conval == Converter.YahooDaily)
                        {
                            bl = BarListImpl.DayFromYahoo(sym);
                        }
                        else if (_conval == Converter.EuronextDaily)
                        {
                            if (!System.Text.RegularExpressions.Regex.IsMatch(sym, "[A-Z0-9]{12}", System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                            {
                                debug("\"" + sym + "\" is not a valid ISIN.  Euronext expects ISINs!");
                                continue;
                            }
                            bl = BarListImpl.DayFromEuronext(sym);
                        }
                        else
                        {
                            continue;
                        }
                        // convert to tick files
                        if (!TikUtil.TicksToFile(TikUtil.Barlist2Tick(bl), debug))
                        {
                            debug("Error saving downloaded bars.");
                        }
                        // notify
                        debug("downloaded " + bl.Count + " bars of daily data for " + sym + " from " + _conval.ToString());
                    }
                    catch (Exception ex)
                    {
                        debug(sym + " converter error: " + ex.Message + ex.StackTrace);
                    }
                    // update progress
                    progress((double)count++ / syms.Length);
                }
                debug("completed daily download.");
                // we're done
                return;
            }
            OpenFileDialog of = new OpenFileDialog();

            // allow selection of multiple inputs
            of.Multiselect = true;
            // keep track of bytes so we can approximate progress
            long bytes = 0;

            if (of.ShowDialog() == DialogResult.OK)
            {
                List <string> symbols = new List <string>();
                foreach (string file in of.FileNames)
                {
                    _path = Path.GetDirectoryName(file);
                    string sn = Path.GetFileName(file);
                    // get size of current file and append to total size
                    FileInfo fi = new FileInfo(file);
                    bytes += fi.Length;
                    string sym = string.Empty;
                    switch (_conval)
                    {
                    case Converter.QCollector_eSignal:
                        string [] r = Path.GetFileNameWithoutExtension(sn).Split('_');
                        if (r.Length != 2)
                        {
                            sym = Microsoft.VisualBasic.Interaction.InputBox("Symbol data represented by file: " + sn, "File's Symbol", string.Empty, 0, 0);
                        }
                        else
                        {
                            sym = r[0];
                        }
                        break;

                    case Converter.TrueFX:
                        // the symbol name is extracted from the filename
                        // do not rename files downloaded from TrueFX.com
                        string[] symstrs = Path.GetFileNameWithoutExtension(sn).Split('-');
                        sym = symstrs[0];
                        break;

                    default:
                        // guess symbol
                        string guess = Util.rxm(sn, "[^a-z]*([a-z]{1,6})[^a-z]+");
                        // remove extension
                        guess = Util.rxr(guess, "[.].*", string.Empty);
                        // see if it's a clean match, if not don't guess
                        if (!Util.rxmok(guess, "^[a-z]+$"))
                        {
                            guess = string.Empty;
                        }
                        sym = Microsoft.VisualBasic.Interaction.InputBox("Symbol data represented by file: " + sn, "File's Symbol", guess, 0, 0);
                        break;
                    }
                    if (sym != string.Empty)
                    {
                        symbols.Add(sym);
                    }
                }
                // estimate total ticks
                _approxtotal = (int)((double)bytes / 51);
                // reset progress bar
                progress(0);
                // start background thread to convert
                bw.RunWorkerAsync(new convargs(of.FileNames, symbols.ToArray()));
                debug("started conversion");
            }
        }