public static string OnCompilerTransitionAttachedGeneration(FlowWindow windowFrom, FlowWindow windowTo, bool everyPlatformHasUniqueName) { var result = string.Empty; var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>(); foreach (var addon in flowAddons) { result += addon.OnCompilerTransitionAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName); } return(result); }
/// <summary> /// Free Managed Ressources. Typically by calling Dispose on them /// </summary> protected override void DisposeManagedRessources() { CoreUtilities.SafeDispose(ref _genericRepositories); if (_dataContext != null) { _dataContext.Dispose(); _dataContext = null; } base.DisposeManagedRessources(); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); NavigationItem.Title = StaticValues.ExpenseListNavigationItemTitle; ParentViewController.Title = StaticValues.ExpenseListNavigationTitle; var repository = new RepositoryCore(CoreUtilities.GetLogService()); var expenses = repository.GetExpenses(); var listSource = new ExpenseListSource(expenses, this); TableView.Source = listSource; TableView.ReloadData(); }
public static string OnCompilerTransitionGeneration(FlowWindow window) { var result = string.Empty; var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>(); foreach (var addon in flowAddons) { result += addon.OnCompilerTransitionGeneration(window); } return(result); }
void LocMgr_LocationsUpdated(object sender, CLLocationsUpdatedEventArgs e) { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController.LocMgr_LocationsUpdated), "location update event"); if (e.Locations.Count() > 0) { _expense.Longitude = e.Locations[0].Coordinate.Longitude; _expense.Latitude = e.Locations[0].Coordinate.Latitude; showLocationOnMap(); } _locationManager.StopUpdatingLocation(); }
/// <summary> /// Log Integration Process Transaction /// </summary> /// <param name="pResponse"></param> internal void LogIntegrationProcessTransaction(ProcessExecutionResponse pResponse) { try { //5 - Log the Transaction in the 'IntegrationTransactions' table with some usefull information about the output of the integration process. if (pResponse.IntegrationProcessMetadata != null && pResponse.DestinationAdapterResponse != null) { //Initialize Main Integration Transaction Log IntegrationTransaction transaction = new IntegrationTransaction { IntegrationProcessID = pResponse.IntegrationProcessMetadata.IntegrationProcessID, IntegrationTransactionTitle = string.Format("{0} - {1}", pResponse.IntegrationProcessMetadata.IntegrationProcessTitle, pResponse.Request.RequestDate.ToStandardFormat(true)), IntegrationTransactionDate = DateTime.Now, TransactionStatus = (int)pResponse.Status, Description = pResponse.StatusDescription, RecordStatus = (int)RecordAuditStatus.Active, RecordCreated = DateTime.Now, RecordCreatedBy = Constants.SystemUser, RecordLastUpdate = DateTime.Now, RecordLastUpdateBy = Constants.SystemUser, IntegrationTransactionDetails = new Collection <IntegrationTransactionDetail>() }; foreach (DBRecordInfo dbRecordInfo in pResponse.DestinationAdapterResponse.Results) { transaction.IntegrationTransactionDetails.Add(new IntegrationTransactionDetail { IntegrationTransactionDetailStatus = dbRecordInfo.RecordTransactionStatus.GetValue <Byte>(), IntegrationTransactionDetailData = CoreUtilities.ConstructXmlFromRecord(dbRecordInfo), Description = string.Format("{0}-{1}", dbRecordInfo.DbRecordID, dbRecordInfo.RecordTransactionStatus.GetDescription()), RecordStatus = (int)RecordAuditStatus.Active, RecordCreated = DateTime.Now, RecordCreatedBy = Constants.SystemUser, RecordLastUpdate = DateTime.Now, RecordLastUpdateBy = Constants.SystemUser, }); } base.AppRuntime.DataService.AddEntity(transaction); base.AppRuntime.DataService.SaveChanges(); } } catch (Exception ex) { LogManager.LogException(ex); } }
public static bool IsCompilerTransitionAttachedGeneration(FlowWindow windowFrom, FlowWindow windowTo) { var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>(); foreach (var addon in flowAddons) { if (addon.IsCompilerTransitionAttachedGeneration(windowFrom, windowTo) == true) { return(true); } } return(false); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); ParentViewController.Title = StaticValues.SettingsNavigationTitle; var repository = new RepositoryCore(CoreUtilities.GetLogService()); _appSettings = repository.GetAppSettings(); handleMonthSelector(); handleYearSelector(); Settings_DeleteAllDataBtn.TouchUpInside += Settings_DeleteAllDataBtn_TouchUpInside; }
void loadCategorySelector() { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "load categoryies"); _categories = (new RepositoryCore(CoreUtilities.GetLogService())).GetCategories(); var categoryNames = _categories.Select(c => c.Name).ToList(); var categorySelectorModel = new CategorySelectorModel(categoryNames); CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "assiging model for the category selector"); ExpenseDetail_Category.Model = categorySelectorModel; if (_expense.Value != 0) { ExpenseDetail_Category.Select(categoryNames.IndexOf(_expense.GetCategory().Name), 0, true); } }
public virtual void RunTest(string[] firstInput, string[] secondInput, string[] expectedOutput, params string[] labels) { IList <CoreLabel> input1 = CoreUtilities.ToCoreLabelList(words, tags, firstInput); IList <CoreLabel> input2 = CoreUtilities.ToCoreLabelList(words, tags, secondInput); IList <CoreLabel> result = CoreUtilities.ToCoreLabelList(words, tags, expectedOutput); ICollection <string> auxLabels = new HashSet <string>(); foreach (string label in labels) { auxLabels.Add(label); } ClassifierCombiner.MergeTwoDocuments(input1, input2, auxLabels, "O"); NUnit.Framework.Assert.AreEqual(result, input1); }
public static Vector2 OnDrawNodeCurveOffset(FlowSystemEditorWindow flowEditor, UnityEngine.UI.Windows.AttachItem attachItem, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSide) { var offset = Vector2.zero; var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>(); foreach (var addon in flowAddons) { addon.flowEditor = flowEditor; offset += addon.OnFlowDrawNodeCurveOffset(attachItem, fromWindow, toWindow, doubleSide); } return(offset); }
/// <summary> /// Runs the algorithm instance. /// </summary> /// <param name="refreshInterval"></param> /// <returns></returns> protected virtual async Task <bool> Run() { try { UpdateAlgorithmInstanceProperty("Status", (short?)AlgorithmStatus.Running); AddAlgorithmMessage(string.Format("{0} is running.", _shortClassName), true, TraceEventType.Information); List <PriceBar> bars = null; while (!_suspended()) { if (_chartsInitialized && (CoreUtilities.InList <short>((short)DataManager.ApiConnectionStatus , (short)ApiConnectionStatus.Connected, (short)ApiConnectionStatus.Streaming))) { List <Tuple <string, EGranularity> > specList = GetChartsSpecList(); bars = await DataManager.Instance.GetPriceBars(specList, 2); if (bars != null) { if (bars.Count != (specList.Count * 2)) { string message = string.Format("RatesDataSource did not return expected count {0} of bars.", specList.Count); AddAlgorithmMessage(message, true, TraceEventType.Information); } else { bars.ForEach(b => AddAlgorithmMessage(string.Format("{0}: High: {1}, Low: {2}, Last: {3}", b.instrument, b.highMid, b.lowMid, b.closeMid), false)); UpdateCharts(bars); ProcessCharts(); } } } await Task.Delay(TimeSpan.FromMilliseconds(_chartRefreshMilliSeconds)); } } catch (Exception e) { AddAlgorithmException(e).Wait(); return(false); } return(true); }
private DirectoryInfo GetDirectory(string path, string description) { if (string.IsNullOrWhiteSpace(path)) { throw new ConfigurationErrorsException($"{description} not provided, please set in AbcSync configuration."); } var directory = Path.Combine(CoreUtilities.WebRootPath(), path); if (!Directory.Exists(directory)) { throw new ConfigurationErrorsException($"{description} could not be found at " + directory); } return(new DirectoryInfo(directory)); }
private string GetPath(string path, string description) { if (string.IsNullOrWhiteSpace(path)) { throw new ConfigurationErrorsException($"{description} not provided, please set in AbcSync configuration."); } var fullPath = Path.Combine(CoreUtilities.AppPath(), path); if (!File.Exists(fullPath) && !Directory.Exists(fullPath)) { throw new ConfigurationErrorsException($"{description} could not be found at " + fullPath); } return(fullPath); }
public virtual void OutputResults(string[] firstInput, string[] secondInput, string[] expectedOutput, params string[] labels) { IList <CoreLabel> input1 = CoreUtilities.ToCoreLabelList(words, tags, firstInput); IList <CoreLabel> input2 = CoreUtilities.ToCoreLabelList(words, tags, secondInput); IList <CoreLabel> result = CoreUtilities.ToCoreLabelList(words, tags, expectedOutput); ICollection <string> auxLabels = new HashSet <string>(); foreach (string label in labels) { auxLabels.Add(label); } ClassifierCombiner.MergeTwoDocuments(input1, input2, auxLabels, "O"); foreach (CoreLabel word in input1) { System.Console.Out.WriteLine(word.Word() + " " + word.Tag() + " " + word.Get(typeof(CoreAnnotations.AnswerAnnotation))); } }
void showLocationOnMap() { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController.showLocationOnMap)); var annotation = new MKPointAnnotation(); var coordination = new CLLocationCoordinate2D(_expense.Latitude, _expense.Longitude); annotation.Coordinate = coordination; ExpenseDetail_Map.RemoveAnnotations((ExpenseDetail_Map.Annotations)); ExpenseDetail_Map.AddAnnotation(annotation); var region = new MKCoordinateRegion(); region.Center.Latitude = coordination.Latitude; region.Center.Longitude = coordination.Longitude; region.Span.LatitudeDelta = 0.01; region.Span.LongitudeDelta = 0.01; ExpenseDetail_Map.SetRegion(region, true); }
protected virtual StrategyTransaction SaveStrategyTransaction(Transaction t) { // create a new record for oanda transactions StrategyTransaction transaction = null; if (!CoreUtilities.InList <string>(t.type , MACC.Constants.TransactionTypes.LimitOrderCreate , MACC.Constants.TransactionTypes.MarketIfTouchedOrderCreate , MACC.Constants.TransactionTypes.MarketOrderCreate)) { if (t.tradeOpened != null) // fill { transaction = CreateFillTransaction(t); } else if (t.type == MACC.Constants.TransactionTypes.OrderCancel) { transaction = CreateOrderCancelTransaction(t, t.instrument, t.side, t.time, t.type, t.price, t.id.ToString(), t.orderId.ToString(), t.reason); } else if (t.type == MACC.Constants.TransactionTypes.OrderUpdate) { transaction = CreateOrderUpdateTransaction(t.instrument, t.side, t.time, t.type, t.price, t.takeProfitPrice, t.stopLossPrice, t.id.ToString(), t.orderId.ToString()); } else if (t.type == MACC.Constants.TransactionTypes.TradeUpdate) { transaction = CreateTradeUpdateTransaction(t, t.instrument, t.side, t.time, t.type, t.price, t.takeProfitPrice, t.stopLossPrice, t.id.ToString(), t.tradeId.ToString()); } else if (t.tradeId > 0 || CoreUtilities.InList <string>(t.type , MACC.Constants.TransactionTypes.StopLossFilled , MACC.Constants.TransactionTypes.TakeProfitFilled , MACC.Constants.TransactionTypes.TradeClose)) // close { transaction = CreateExitTransaction(t, t.instrument, t.side, t.time, t.type, t.price, t.id.ToString(), t.tradeId.ToString()); } if (transaction != null) { StrategyCaller.Instance().SaveStrategyTransactionAsync(transaction, MarketMiner.Common.Constants.Brokers.OANDA); } } return(transaction); }
void loadExpense() { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController.loadExpense)); try { _expense = new Expense(ExpenseId); ExpenseDetail_Value.Text = _expense.Value.ToString(); ExpenseDetail_Description.Text = _expense.Description; ExpenseDetail_Date.Date = _expense.ExpenseDate.ToNSDate(); if (_expense.Latitude != 0 && _expense.Longitude != 0) { showLocationOnMap(); } } catch { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "load expenses as a new expense"); _expense = new Expense(); } }
async void ExpenseDetail_RecieptBtn_TouchUpInside(object sender, EventArgs e) { _isFromCamara = true; CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "adding receipt"); var authorizationStatus = AVCaptureDevice.GetAuthorizationStatus(AVMediaType.Video); CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "checking for camera authorization"); if (authorizationStatus != AVAuthorizationStatus.Authorized) { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "asking for camera access"); await AVCaptureDevice.RequestAccessForMediaTypeAsync(AVMediaType.Video); } CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "loading camera"); Camera.TakePicture(this, (obj) => { var photo = obj.ValueForKey(new NSString("UIImagePickerControllerOriginalImage")) as UIImage; _recieptImageData = photo.AsJPEG(); }); }
public static void OnDrawSettingsGUI(FlowSystemEditorWindow flowEditor) { var flowAddons = CoreUtilities.GetAddons <FlowAddon>((name, item) => item.name = name); if (flowAddons.Count == 0) { GUILayout.Label("No Modules Has Been Installed."); } else { foreach (var addon in flowAddons) { #if DEBUGBUILD Profiler.BeginSample("[ GUI ] Addon " + addon.name); #endif addon.flowEditor = flowEditor; Flow.DrawModuleSettingsGUI(addon, addon.GetName(), addon.GetSettingsMenu(null), () => { addon.OnFlowSettingsGUI(); }); #if DEBUGBUILD Profiler.EndSample(); #endif } } CustomGUI.Splitter(); GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (GUILayoutExt.LargeButton("Install Modules...", 40f, 200f) == true) { Application.OpenURL(VersionInfo.DOWNLOAD_LINK); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController.ViewDidAppear)); if (_expense.ReceiptImage == null && !_isFromCamara) { ExpenseDetail_Receipt.Image = new UIImage("Assets/receipt.png"); } else { //ExpenseDetail_RecieptBtn.SetTitle("Show Reciept", UIControlState.Normal); try { if (_isFromCamara) { ExpenseDetail_Receipt.Image = new UIImage(_recieptImageData); } else { if (_expense.ReceiptImage == null) { ExpenseDetail_Receipt.Image = new UIImage("Assets/receipt.png"); } else { ExpenseDetail_Receipt.Image = new UIImage(_expense.ReceiptImage); } } } catch { ExpenseDetail_Receipt.Image = new UIImage("Assets/receipt.png"); } } _isFromCamara = false; }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); ParentViewController.Title = StaticValues.ReportNavigationTitle; foreach (var view in View.Subviews) { view.RemoveFromSuperview(); } SFChart chart = new SFChart(); chart.Frame = this.View.Frame; chart.Legend.Visible = true; SFCategoryAxis primaryAxis = new SFCategoryAxis(); chart.PrimaryAxis = primaryAxis; chart.ColorModel.Palette = SFChartColorPalette.Custom; chart.ColorModel.CustomColors = NSArray.FromObjects(StaticValues.DarkBlue, StaticValues.LightBlue); var repository = new RepositoryCore(CoreUtilities.GetLogService()); var topCategories = repository.GetTopCategories(); var totalExpense = repository.GetExpenses(); var averageSpent = totalExpense.Count == 0 ? 0 : totalExpense.Average(e => e.Value); if (topCategories.Count > 0) { var dataModel = new ReportChartDataSource(topCategories, averageSpent); chart.DataSource = dataModel as SFChartDataSource; this.View.AddSubview(chart); chart.Frame = new RectangleF(10, 70, (float)View.Bounds.Width - 10, (float)View.Bounds.Height - 160); } }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. // If not required for your application you can safely delete this method // Code to start the Xamarin Test Cloud Agent #if ENABLE_TEST_CLOUD Xamarin.Calabash.Start(); #endif MobileCenter.Start("784c62e5-d8ec-4c2b-9d16-751016a6b84e", typeof(Analytics), typeof(Crashes)); Crashes.GetErrorAttachments = (ErrorReport report) => { return(new ErrorAttachmentLog[] { ErrorAttachmentLog.AttachmentWithText(CoreUtilities.GetLogService().GetLogs(), "events.txt"), }); }; CoreUtilities.GetLogService().Log(nameof(AppDelegate.FinishedLaunching), "right after errors attached"); CoreUtilities.SetUpDatabase(false, true); return(true); }
string saveReciept() { try { NSError err = null; var documentsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var jpgFilename = System.IO.Path.Combine(documentsDirectory, $"{Guid.NewGuid().ToString()}.jpg"); if (_recieptImageData.Save(jpgFilename, false, out err)) { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "image taken and everything is fine"); return(jpgFilename); } else { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), $"image not saved because: {err.LocalizedDescription}"); return(null); } }catch (Exception ex) { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController.saveReciept), ex.Message); return(null); } }
void ExpenseDetail_Delete_Clicked(object sender, EventArgs e) { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "try to delete expense"); _expense.Delete(); NavigationController.PopViewController(true); }
/// <summary> /// Get Integration Transaction Details /// </summary> /// <param name="pIntegrationTransactionID"></param> /// <returns></returns> public DataTable GetIntegrationTransactionDetails(int pIntegrationTransactionID) { DataTable dtResults = null; IntegrationTransaction transaction = null; try { dtResults = new DataTable(Constants.TableName_Results); transaction = base.AppRuntime.DataService.GetEntity(GetDataRequest <IntegrationTransaction> .Create(c => c.IntegrationTransactionID == pIntegrationTransactionID, "IntegrationProcess.IntegrationProcessMappings.SourceIntegrationAdapterField", "IntegrationProcess.IntegrationProcessMappings.DestinationIntegrationAdapterField", "IntegrationTransactionDetails")); if (transaction != null) { DataColumn col_ID = new DataColumn(Constants.ColumnName_ID, typeof(Int32)); dtResults.Columns.Add(col_ID); DataColumn col_RecordStatus = new DataColumn(Constants.ColumnName_RecordStatus, typeof(String)); dtResults.Columns.Add(col_RecordStatus); if (transaction.IntegrationProcess != null) { List <string> columns = new List <string>(); foreach (IntegrationProcessMapping mappingItem in transaction.IntegrationProcess.IntegrationProcessMappings.Where(c => c.DestinationIntegrationAdapterField != null)) { if (!dtResults.Columns.Contains(mappingItem.DestinationIntegrationAdapterField.FieldName)) { DataColumn dcMappingField = new DataColumn( mappingItem.DestinationIntegrationAdapterField.FieldName, DataUtilities.GetMappedType(mappingItem.DestinationIntegrationAdapterField.FieldDataTypeEnum)); dtResults.Columns.Add(dcMappingField); columns.Add(dcMappingField.ColumnName); } } foreach (IntegrationTransactionDetail detail in transaction.IntegrationTransactionDetails) { try { DataRow drDetail = dtResults.NewRow(); drDetail[col_ID] = detail.IntegrationTransactionDetailID; drDetail[col_RecordStatus] = ((RecordTransactionStatus)detail.IntegrationTransactionDetailStatus).GetDescription(); StringReader dataReader = new StringReader( CoreUtilities.GetString(detail.IntegrationTransactionDetailData)); XElement xData = XElement.Load(dataReader); foreach (XElement item in xData.Nodes()) { string columnName = CoreUtilities.FormatXMLColumnName(item.Name.LocalName, false); if (columnName != Constants.ColumnName_RecordStatus && drDetail.Table.Columns.Contains(columnName)) { drDetail[columnName] = DataUtilities.ConvertValueToDataColumnType( item.Value, drDetail.Table.Columns[columnName].DataType); } } dtResults.Rows.Add(drDetail); } catch (Exception ex) { LogManager.LogException(ex); } } } } } catch (Exception ex) { LogManager.LogException(ex); } finally { transaction = null; } return(dtResults); }
void ExpenseDetail_Cancel_Clicked(object sender, EventArgs e) { CoreUtilities.GetLogService().Log(nameof(ExpenseDetailController), "caceling expense page"); NavigationController.PopViewController(true); }
void Settings_DeleteAllDataBtn_TouchUpInside(object sender, EventArgs e) { var okCancelAlertController = UIAlertController.Create("Delete All Data", "Are you sure?", UIAlertControllerStyle.Alert); okCancelAlertController.AddAction(UIAlertAction.Create("I'm Sure", UIAlertActionStyle.Default, alert => CoreUtilities.SetUpDatabase(true, false))); okCancelAlertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, alert => Console.WriteLine("Cancel was clicked"))); PresentViewController(okCancelAlertController, true, null); }
private void HandleGrounded() { var movement = input.held.direction.Vector; var resolvedVelocity = entity.velocity; FlagsHelper.Unset(ref state, State.JUMP); wallJumpImpactDirection.Clear(); // Horizontal movement. resolvedVelocity.x = movement.x * data.velocityHorizontalGroundMax; if (!FlagsHelper.IsSet(state, State.CROUCH)) { if (input.held.crouch) { var newBounds = entity.LocalScale; var crouchPosition = entity.Position; newBounds.x *= data.boundsMultiplierCrouchX; newBounds.y *= data.boundsMultiplierCrouchY; crouchPosition.y -= entity.LocalScale.y; var sizeOffset = CoreUtilities.GetWorldSpaceSize(newBounds, entity.collider as BoxCollider2D, 0.5f).x; var checkDistance = newBounds.x; var hitLeft = entity.Check(Constants.Directions.LEFT, checkDistance); var hitRight = entity.Check(Constants.Directions.RIGHT, checkDistance); if (hitLeft) { crouchPosition.x = hitLeft.point.x + sizeOffset; } if (hitRight) { crouchPosition.x = hitRight.point.x - sizeOffset; } entity.SetLocalScale(newBounds); entity.SetPosition(crouchPosition); FlagsHelper.Set(ref state, State.CROUCH); } } if (!input.held.jump) { additiveJumpFrameCount = 0; jumpCount = 0; } // Jump if (input.pressed.jump) { if (jumpCount < data.jumpCountMax) { resolvedVelocity.y = data.velocityJumpImpulse; jumpCount++; } } entity.SetVelocity(resolvedVelocity); }