private void fillDimensionComboBox() { ImageComboBoxItem defaultItem = null; _dimensionComboBox.Properties.Items.Clear(); foreach (var dimension in _importDataColumn.CurrentlySupportedDimensions) { var newItem = new ImageComboBoxItem { Description = dimension.DisplayName, Value = dimension.Name }; if (dimension.IsDefault) { defaultItem = newItem; } _dimensionComboBox.Properties.Items.Add(newItem); } if (_dimensionComboBox.Properties.Items.Contains(defaultItem)) { _dimensionComboBox.EditValue = DimensionHelper.GetDefaultDimension(_importDataColumn.Dimensions).Name; } else if (_dimensionComboBox.Properties.Items.Count > 0) { _dimensionComboBox.EditValue = _dimensionComboBox.Properties.Items[0]; } }
private Dimension getDimensionFromUnitSelection() { if (!_units.ContainsKey(_unitComboBox.Text)) { throw new Exception("An unexpected error occured"); } var dimensionName = _units[_unitComboBox.Text]; var dimension = DimensionHelper.FindDimension(_importDataColumn.Dimensions, dimensionName); return(dimension); }
public bool SetUnitInTableForColumnName(Dimension dimension, Unit unit, string columnName) { if (!_table.Columns.ContainsName(columnName)) { return(false); } var column = _table.Columns.ItemByName(columnName); column.ActiveDimension = DimensionHelper.FindDimension(column.Dimensions, dimension.Name); DimensionHelper.TakeOverInputParameters(dimension, column.ActiveDimension); column.ActiveUnit = column.ActiveDimension.FindUnit(unit.Name); column.IsUnitExplicitlySet = true; return(true); }
private void InitializeViewPager(View view, int position) { var viewPager = view.FindViewById <ViewPager>(Resource.Id.pager); viewPager.SetClipToPadding(false); viewPager.PageMargin = DimensionHelper.DpToPx(12); // in production environment, images have to be loaded from ViewModel // Note: user ChildFragmentManager instead of FragmentManager. By this way the ViewPager is there after a back as well. // See: http://stackoverflow.com/questions/32560394/viewpager-data-lost-when-coming-back-from-next-screen viewPager.Adapter = new SwipeGalleryStateAdapter(ChildFragmentManager, GalleryRepository.Images); viewPager.SetCurrentItem(position, false); }
public override void ViewDidLoad() { View = new UIView { BackgroundColor = UIColor.White, MultipleTouchEnabled = false }; ResolutionHelper.InitStaticVariable(); DimensionHelper.InitStaticVariable(); base.ViewDidLoad(); InitView(); CreateBinding(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); var position = Intent.GetIntExtra(POSITION, 0); var viewPager = FindViewById <ViewPager>(Resource.Id.pager); viewPager.SetClipToPadding(false); viewPager.PageMargin = DimensionHelper.DpToPx(12); viewPager.Adapter = new SwipeGalleryStateAdapter(SupportFragmentManager, Config.Images); viewPager.SetCurrentItem(position, false); }
public ImportDataTable ConvertToImportDataTable(IReadOnlyList <MetaDataCategory> metaDataCategories, IEnumerable <ColumnInfo> columnInfos) { var retVal = new ImportDataTable(); if (metaDataCategories != null && metaDataCategories.Count > 0) { retVal.MetaData = convertToMetaDataTable(metaDataCategories); } foreach (var columnInfo in columnInfos) { var column = new ImportDataColumn { ColumnName = columnInfo.Name, DisplayName = columnInfo.DisplayName, Description = columnInfo.Description, DataType = columnInfo.DataType, Required = (columnInfo.IsMandatory || columnInfo.NullValuesHandling == NullValuesHandlingType.NotAllowed), SkipNullValueRows = (columnInfo.NullValuesHandling == NullValuesHandlingType.DeleteRow), }; if (columnInfo.MetaDataCategories != null && columnInfo.MetaDataCategories.Count > 0) { column.MetaData = convertToMetaDataTable(columnInfo.MetaDataCategories); } if (columnInfo.DimensionInfos != null && columnInfo.DimensionInfos.Count > 0) { column.Dimensions = columnInfo.DimensionInfos.Select(dimensioninfo => dimensioninfo.ConvertToDimensions()).ToList(); column.ActiveDimension = DimensionHelper.FindDimension(column.Dimensions, columnInfo.DefaultDimension.Name); } if (!string.IsNullOrEmpty(columnInfo.RelatedColumnOf)) //column is error column, so we need auxiliary type as metadata { column.ColumnNameOfRelatedColumn = columnInfo.RelatedColumnOf; //Add AuxiliaryType meta data category if (column.MetaData == null) { column.MetaData = new MetaDataTable(); } var listOfValues = new Dictionary <string, string> { { Constants.STD_DEV_ARITHMETIC, Constants.STD_DEV_ARITHMETIC }, { Constants.STD_DEV_GEOMETRIC, Constants.STD_DEV_GEOMETRIC } }; //if there is only the dimensionless dimension defined only geometric error make sense if (column.Dimensions.Count == 1) { if (column.Dimensions[0].IsDimensionless()) { listOfValues.Remove(Constants.STD_DEV_ARITHMETIC); } } var auxiliaryTypeColumn = new MetaDataColumn { ColumnName = Constants.AUXILIARY_TYPE, DisplayName = "Error Type", DataType = typeof(string), Description = "What is the type of error?", ListOfValues = new Dictionary <string, string>(listOfValues), IsListOfValuesFixed = true, Required = true }; column.MetaData.Columns.Add(auxiliaryTypeColumn); // add special condition to the dimensions // for geometric error the unit must be dimensionless // for arithmetic the unit must be a concrete dimension foreach (var dim in column.Dimensions) { if (dim.MetaDataConditions == null) { dim.MetaDataConditions = new Dictionary <string, string>(); } if (dim.IsDimensionless()) { dim.MetaDataConditions.Add(Constants.AUXILIARY_TYPE, Constants.STD_DEV_GEOMETRIC); if (dim.IsDefault) { auxiliaryTypeColumn.DefaultValue = Constants.STD_DEV_GEOMETRIC; } } else { dim.MetaDataConditions.Add(Constants.AUXILIARY_TYPE, Constants.STD_DEV_ARITHMETIC); if (dim.IsDefault) { auxiliaryTypeColumn.DefaultValue = Constants.STD_DEV_ARITHMETIC; } } } } retVal.Columns.Add(column); } return(retVal); }
private void DoTransaction(string TransactionCode) { TransactionExecution Execution = new TransactionExecution(this.UserContext); bool ReturnAfterDcal = false; if (this.UserContext.Status != TroposStatus.AwaitingTransaction) { Execution.DoReply("N", new ElectronicSignatureData(), int.Parse(this.UserContext.DataValidAttachKey, CultureInfo.InvariantCulture)); } bool?NoUpdate = Session["DcalNoUpdate"] as bool?; if (NoUpdate != null && (bool)NoUpdate && TransactionCode == "UCAL") { // No Update flag is set, so do DCAL instead of UCAL TransactionCode = "DCAL"; ReturnAfterDcal = true; } Session["CalculatorModeFieldValues"] = DimensionHelper.EvaluateFields(TroposFields.Controls[3].Controls); ExecuteReturn ReturnValue; ReturnValue = Execution.DoTransaction(TroposFields.Controls[3].Controls, TransactionCode, ScreenCode, false, false); { Dictionary <string, string> FieldValues = null; Dictionary <string, string> _fieldValues = null; object SessionFieldValues = null; DataTable FieldValuesTable = ReturnValue.FieldValuesTable; DataRow FieldValuesRow = FieldValuesTable.Rows[0]; switch (ReturnValue.WaitefReturn) { case "ExoutvarOk": case "Exread": case "Exread2": // The DCAL transaction comes here - set up the fields in case we need to return them FieldValuesTable = ReturnValue.FieldValuesTable; FieldValuesRow = FieldValuesTable.Rows[0]; FieldValues = RowToDictionary(FieldValuesTable, FieldValuesRow); if (ReturnAfterDcal) { TransactionReturn(FieldValues); } break; case "ExdoneOk": // UCAL comes here - set up the fields from the pre-update values, then add the result fields SessionFieldValues = Session["CalculatorModeFieldValues"]; if (SessionFieldValues != null) { FieldValues = (Dictionary <string, string>)SessionFieldValues; Session.Remove("CalculatorModeFieldValues"); } FieldValuesTable = ReturnValue.FieldValuesTable; FieldValuesRow = FieldValuesTable.Rows[0]; _fieldValues = RowToDictionary(FieldValuesTable, FieldValuesRow); FieldValues["iATTVALFROM-DQ"] = _fieldValues["iATTVALFROM-DQ"]; FieldValues["iUOM-ATT1"] = _fieldValues["iUOM-ATT1"]; TransactionReturn(FieldValues); break; case "ExoutvarFail": TroposResourceProvider Trp = new TroposResourceProvider(UserContext); if (ReturnValue.Message.Trim() == Trp.GetResource("MSG_NO_CHANGES")) { switch (TransactionCode) { case "UCAL": // set up the fields from the pre-update values, then add the result fields SessionFieldValues = Session["CalculatorModeFieldValues"]; if (SessionFieldValues != null) { FieldValues = (Dictionary <string, string>)SessionFieldValues; Session.Remove("CalculatorModeFieldValues"); } FieldValuesTable = ReturnValue.FieldValuesTable; FieldValuesRow = FieldValuesTable.Rows[0]; _fieldValues = RowToDictionary(FieldValuesTable, FieldValuesRow); FieldValues["iATTVALFROM-DQ"] = _fieldValues["iATTVALFROM-DQ"]; FieldValues["iUOM-ATT1"] = _fieldValues["iUOM-ATT1"]; TransactionReturn(FieldValues); break; case "DCAL": if (ReturnAfterDcal) { FieldValuesTable = ReturnValue.FieldValuesTable; FieldValuesRow = FieldValuesTable.Rows[0]; FieldValues = RowToDictionary(FieldValuesTable, FieldValuesRow); TransactionReturn(FieldValues); } break; } } break; } } ValidationResult MandatoryCheckResult = new ValidationResult(); Execution.LoadScreenFields( ReturnValue.FieldValuesTable, ReturnValue.Message, ReturnValue.ScrollTable, ReturnValue.TextTable, TroposFields.Controls[3].Controls, TransactionCode, MandatoryCheckResult); Label ErrorField = (Label)TroposFields.FindControl("eError"); if (ErrorField != null) { if (ReturnValue.Success) { ErrorField.Text = ""; ErrorField.CssClass = "TroposError TroposDisplay TroposField"; } else { ErrorField.Text = ReturnValue.Message; if (string.IsNullOrEmpty(ReturnValue.Message)) { ErrorField.CssClass = "TroposError TroposDisplay TroposField"; } else { ErrorField.CssClass = "TroposErrorPopulated TroposDisplay TroposField"; } } } }