async void CreateDrop(ParseItem dropData) { ShowLoadingView(Constants.STR_LOADING); string result = ""; if (dropData._pObject == null) { result = await ParseService.AddDropItem(dropData); } else { result = await ParseService.UpdateDrop(dropData); } HideLoadingView(); if (result == Constants.STR_STATUS_SUCCESS) { //SuccessPopUp cpuv = SuccessPopUp.Create(); //cpuv.PopUp(true, ShareDropLocation, Back); } else { ShowMessageBox(null, result); } }
private void Execute() { if (_options.Interactive) { Repl repl = new(); repl.Run(); return; } string content = File.ReadAllText(@"C:\Source\BrunoLang\Samples\Example1.bruno"); //var content = "x = 1 + 2"; BrunoProgram program = ParseService.Parse(content); //Console.WriteLine(content); //Console.WriteLine("---"); //Console.WriteLine(program); //Console.WriteLine("---"); Console.WriteLine(program.Evaluate()?.ToString()); //if (_options.Verbose) //{ // Console.WriteLine($"Verbose output enabled. Current Arguments: -v {_options.Verbose}"); // Console.WriteLine("Quick Start Example! App is in Verbose mode!"); //} //else //{ // Console.WriteLine($"Current Arguments: -v {_options.Verbose}"); // Console.WriteLine("Quick Start Example!"); //} }
public void TestMethod4() { var service = new ParseService(); var result = service.Execute(urls[3]); Assert.IsNotNull(result); }
void GetDrops() { System.Threading.ThreadPool.QueueUserWorkItem(delegate { ShowLoadingView(Constants.STR_DROPS_LOADING); mDrops = ParseService.GetDropItems(); if (_map == null) { return; } dropIDs = new List <string>(); for (int i = 0; i < mDrops.Count; i++) { var drop = mDrops[i]; if (drop.IsVisibilityByUser()) { AddDropInMap(drop, i); } } HideLoadingView(); }); }
public override Task StartAsync(CancellationToken cancellationToken) { _logger.LogInformation($"Worker started at: {DateTime.Now}"); _settings = ReadJsonFile(); if (_settings.Username == null) { _logger.LogInformation("No username provided..."); throw new Exception("No username provided"); } _uploadService = new UploadService(_settings.Endpoint); _parseService = new ParseService(); _memCache = new MemoryCache(new MemoryCacheOptions()); _memCacheOptions = new MemoryCacheEntryOptions() .SetSlidingExpiration(TimeSpan.FromMilliseconds(CacheTimeMilliseconds)) .RegisterPostEvictionCallback(callback: OnRemovedFromCache, state: this); _watcher = new FileSystemWatcher(_settings.Path, _settings.FileExtension) { NotifyFilter = NotifyFilters.LastWrite }; _watcher.Changed += new FileSystemEventHandler(OnChanged); _watcher.EnableRaisingEvents = true; _logger.LogInformation("Started watching..."); return(base.StartAsync(cancellationToken)); }
public void Parse() { var tMatch = Regex.Match(this.Raw, TrendPatt); this.Evolution = ParseService.GetTrendType(tMatch.Groups["evol"].Value); if (this.Evolution != TrendType.NOSIG) { if (tMatch.Groups["fm"].Success) { this.ValidityPeriod = new Period(ParseService.GetDate(tMatch.Groups["fmv"].Value, this.Date), this.Date + new TimeSpan(1, 00, 00)); } else if (tMatch.Groups["fm"].Success && tMatch.Groups["tl"].Success) { this.ValidityPeriod = new Period(ParseService.GetDate(tMatch.Groups["fmv"].Value, null), ParseService.GetDate(tMatch.Groups["tlv"].Value, null)); } else if (tMatch.Groups["tl"].Success) { this.ValidityPeriod = new Period(this.Date.Value, ParseService.GetDate(tMatch.Groups["tlv"].Value, this.Date)); } else if (tMatch.Groups["at"].Success) { this.ValidityPeriod = new Period(ParseService.GetDate(tMatch.Groups["atv"].Value, this.Date), this.Date + new TimeSpan(1, 00, 00)); } if (tMatch.Groups["wind"].Success) { var res = ParseService.GetWind(tMatch.Groups["wind"].Value); this.Wind = res.Result; this.Errors = this.Errors.Concat(res.Errors); } this.IsCavok = tMatch.Groups["cavok"].Success; if (!this.IsCavok) { if (tMatch.Groups["vis"].Success) { var res = ParseService.GetVisibility(tMatch.Groups["vis"].Value); this.Visibility = res.Result; this.Errors = this.Errors.Concat(res.Errors); } if (tMatch.Groups["weather"].Success) { var res = ParseService.GetWeather(tMatch.Groups["weather"].Value); this.Weathers = res.Result; this.Errors = this.Errors.Concat(res.Errors); } if (tMatch.Groups["sky"].Success) { var res = ParseService.GetSkyCondition(tMatch.Groups["sky"].Value); this.Clouds = res.Result; this.Errors = this.Errors.Concat(res.Errors); } } } }
static void Main(string[] args) { var path = args[0]; var lastBestResult = 0; if (args.Length > 1) { lastBestResult = int.Parse(args[1]); } try { var environment = ParseService.ParseInput(path); DijkstraShortestRouteService.CalculateShortestRoute(environment.Graph); GraspService GraspService = new GraspService(); var result = GraspService.GetResult(environment); //Console.WriteLine("\n"); //Console.WriteLine("Accumulated Profit: " + environment.AccumulatedProfit.ToString()); Console.WriteLine("Original Environment:"); Console.WriteLine("--------------------\n"); result[0].PrintResume(); Console.WriteLine("Final Result:"); Console.WriteLine("------------\n"); result[1].PrintResume(); Console.ReadLine(); } catch (Exception ex) { Console.Write(ex.Message); } }
void GetFavoriteDrops() { var listView = FindViewById <ListView>(Resource.Id.listView); System.Threading.ThreadPool.QueueUserWorkItem(delegate { ShowLoadingView(Constants.STR_F_DROPS_LOADING); mfDrops = new List <ParseItem>(); var drops = ParseService.GetDropItems(); foreach (var drop in drops) { ItemModel ItemModel = new ItemModel(); ItemModel.parseItem = drop; var favoriteList = ItemModel.Favorite; foreach (var favoriteID in favoriteList) { if (favoriteID.Equals(ParseUser.CurrentUser.ObjectId)) { mfDrops.Add(drop); } } } var adapter = new FavoriteAdapter(this, mfDrops, RemoveCallBack, MapCallBack); RunOnUiThread(() => { listView.Adapter = adapter; adapter.NotifyDataSetChanged(); HideLoadingView(); }); }); }
void GetFavoriteDrops() { System.Threading.ThreadPool.QueueUserWorkItem(delegate { ShowLoadingView(Constants.STR_F_DROPS_LOADING); mfDrops = new List <ParseItem>(); var drops = ParseService.GetDropItems(); foreach (var drop in drops) { ItemModel ItemModel = new ItemModel(); ItemModel.parseItem = drop; var favoriteList = ItemModel.Favorite; foreach (var favoriteID in favoriteList) { if (favoriteID.Equals(ParseUser.CurrentUser.ObjectId)) { mfDrops.Add(drop); } } } HideLoadingView(); var tblDataSource = new FavoritesTableViewSource(mfDrops, this); this.InvokeOnMainThread(delegate { TableView.Source = tblDataSource; TableView.ReloadData(); }); }); }
static void Main(string[] args) { try { //IMPORTANT: Before running this, set the document folder in the DocumentService, and ensure Employees.txt is in that folder. Console.WriteLine("Hello World!"); var parseService = new ParseService(); var documentService = new DocumentService(); var employeeService = new EmployeeService(parseService, documentService); //1. Gets all paycheck data and creates a document. var paycheckService = new PaycheckService(employeeService, documentService); var paycheckData = paycheckService.GetPaychecks(); //2. Gets top earners and creates a document. var topEarners = paycheckService.GetTopEarners(paycheckData); //3. Gets state data and creates a document var medianService = new MedianService(); var stateService = new StateService(paycheckService, documentService, medianService); var stateData = stateService.GetStateData(paycheckData); //4. Gets ten random employees by EmployeeId and creates a text file with the time to get each of them. var tenRandomEmployees = employeeService.GetTenRandomEmployeesByEmployeeId(logElapsedTime: true); Console.WriteLine("All done! Good-bye world!"); } catch (Exception ex) { string json = JsonConvert.SerializeObject(ex); Console.WriteLine(json); } Console.Read(); }
public void GetParam_WrongIntParam_Exception() { string raw = "val1=1\tval2=TestMessage"; ParsedData data = ParseService.Parse(raw); Assert.Throws <InvalidCastException>(() => data.GetValue <int>("val3")); }
public SkillDataDto Parse(string record) { ParsedData data = ParseService.Parse(record); SkillDataDto skillDataDto = _mapper.Map(data); return(skillDataDto); }
void GetDrops() { System.Threading.ThreadPool.QueueUserWorkItem(delegate { ShowLoadingView(Constants.STR_DROPS_LOADING); mDrops = ParseService.GetDropItems(); HideLoadingView(); if (mDrops.Count == 0) { _locationManager.RemoveUpdates(this); } else { RunOnUiThread(() => { _locationManager.RequestLocationUpdates(LocationManager.GpsProvider, 2000, 1, this); Location currentLocation = _locationManager.GetLastKnownLocation(LocationManager.GpsProvider); OnLocationChanged(currentLocation); }); } }); }
public NpcDataDto Parse(string record) { ParsedData data = ParseService.Parse(record); NpcDataDto npcDataDto = _mapper.Map(data); return(npcDataDto); // return InlineParser.Parse(data); }
public void Setup() { Driver = new InternetExplorerDriver("Resources/"); Logger = new LoggerMock(); Service = new ParseService(Driver, Logger); }
public void Get_ValueWithoutParam() { string raw = "val1=1\tval2=TestMessage\tval4"; ParsedData data = ParseService.Parse(raw); string result2 = data.GetValue <string>(3); Assert.Equal("val4", result2); }
public NewPagesController(ILogger <NewPagesController> logger) { this.logger = logger; configurationService = new ConfigurationService(CONFIG_FILE_PATH); parseService = new ParseService(); telegramService = new TelegramService(configurationService.GetConfig(TELEGRAM_CHANNEL_NAME_KEY)); }
public NewsController(ILogger <NewsController> logger) { this.logger = logger; configurationService = new ConfigurationService(CONFIG_FILE_PATH); parseService = new ParseService(); webhookService = new WebhookService(configurationService.GetConfig(WEBHOOK_TOKEN_KEY)); }
public void Get_NotExistedParam_Null() { string raw = "val1=1\tval2=TestMessage"; ParsedData data = ParseService.Parse(raw); string result1 = data.GetValue <string>("val3"); Assert.Null(result1); }
public void ParseEntryToItemTest_WhenWrongEntry() { var entry = "Cercle MonNom"; var parseService = new ParseService(); var parseItem = parseService.ParseEntryToItem(entry); Assert.IsNull(parseItem); }
public void ParseEntryToItemTest_WhenEmptyEntry() { var entry = string.Empty; var parseService = new ParseService(); var parseItem = parseService.ParseEntryToItem(entry); Assert.IsNull(parseItem); }
public async Task Test_Success_Async() { string testFile = "./TestFiles/test.txt"; (int lineNumber, int[] badLines) = await ParseService.ParseFileAsync(testFile); Assert.Equal(9, lineNumber); Assert.Equal(5, badLines.Length); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); WithValidParseIds(delegate { ParseService.SetAppId(appid, clientid); dvc = new DialogViewController(CreateRoot()); window.RootViewController = new UINavigationController(dvc); }); window.MakeKeyAndVisible(); return(true); }
public void ParseOudeStage__ValidInputString_ReturnsListOfOudeStage() { //Arrange string line = CsvStringBuilder.ParseToCsv(new StageBuilder().Build()); //Act var resultData = ParseService.ParseOudeStage(line.Split(ParseService.DELIMITER)) as OudeStage; //Assert Assert.That(resultData, Is.Not.Null); Assert.That(resultData.EmailPromotor, Is.Not.Null); Assert.That(resultData.VoornaamContactpersoon, Is.Not.Null); Assert.That(resultData.Bemerkingen, Is.Not.Null); }
public void Get() { string raw = "val1=1\tval2=TestMessage"; ParsedData data = ParseService.Parse(raw); string result1 = data.GetValue <string>("val2"); Assert.IsType <string>(result1); int result2 = data.GetValue <int>("val1"); Assert.IsType <int>(result2); }
public void TestNormalModel() { ModelMapper <TestModel> mapper = new ModelMapper <TestModel>(); TestModel model = new TestModel { Id = "1", Name = "TestMessage" }; ParsedData data = ParseService.Parse(testLine); TestModel result = mapper.Map(data); result.Should().BeEquivalentTo(model); }
public void TestMissedFieldsModel() { ModelMapper <MissedFieldsModel> mapper = new ModelMapper <MissedFieldsModel>(); MissedFieldsModel model = new MissedFieldsModel() { Id = "1", Name = null }; ParsedData data = ParseService.Parse(testLine); MissedFieldsModel result = mapper.Map(data); result.Should().BeEquivalentTo(model); }
public void ParseEntryToItemTest_WhenEntryWithWrongType() { var entry = "Cercl MonNom 10"; var parseService = new ParseService(); var parseItem = parseService.ParseEntryToItem(entry); Assert.IsNull(parseItem); entry = "Cercle MonNom test"; parseItem = parseService.ParseEntryToItem(entry); Assert.IsNull(parseItem); }
private async void ParseLogin(User user) { var response = await ParseService.SignUp(user); HideLoadingView(); if (response == Constants.STR_STATUS_SUCCESS) { GoToHomeVC(); } else { ShowMessageBox(Constants.STR_LOGIN_FAIL_TITLE, Constants.STR_LOGIN_FAIL_MSG); } }
public void TestTargetTypeModel() { ModelMapper <TargetTypeModel> mapper = new ModelMapper <TargetTypeModel>(); TargetTypeModel model = new TargetTypeModel() { Id = 1, Name = "TestMessage" }; ParsedData data = ParseService.Parse(testLine); TargetTypeModel result = mapper.Map(data); result.Should().BeEquivalentTo(model); Assert.IsType <int>(result.Id); }