/// <summary> /// Creates Mapped property /// </summary> /// <param name="aAdaptor"> /// Adaptor mapped property is connected to <see cref="IAdaptor"/> /// </param> /// <param name="aIsColumn"> /// Defines if this is column or not <see cref="System.Boolean"/> /// </param> /// <param name="aName"> /// Name of mapped property <see cref="System.String"/> /// </param> /// <param name="aColumnName"> /// Name of column <see cref="System.String"/> /// </param> /// <param name="aRWFlags"> /// Read write flags <see cref="EReadWrite"/> /// </param> /// <param name="aSubItems"> /// Sub items <see cref="SMappedItem"/> /// </param> public MappedProperty(IAdaptor aAdaptor, bool aIsColumn, string aName, string aColumnName, EReadWrite aRWFlags, SMappedItem[] aSubItems) { // Column Mapped property if (aAdaptor == null) { throw new ExceptionMappedPropertyWithNullAdaptor(); } submappings = new ChildMappedProperties(); adaptor = new WeakReference(aAdaptor); if (Adaptor.IsBoundaryAdaptor == true) { throw new ExceptionNonBoundaryMappingSetToBoundary(aName, true, aColumnName); } Name = aName; IsColumnMapping = aIsColumn; originalRWFlags = aRWFlags; RWFlags = aRWFlags; if (IsColumnMapping == true) { submappings = new ChildMappedProperties(); } if (aSubItems != null) { Submappings.Size = aSubItems.Length; foreach (SMappedItem item in aSubItems) { Submappings.AddMapping(new MappedProperty(this, item)); } } ColumnName = aColumnName; Resolve(); }
/// <summary> /// Disconnects adaptors and objects for this link /// </summary> public void Disconnect() { source.Disconnect(); source = null; destination.Disconnect(); destination = null; }
/// <summary> /// Outputs connection information with Debug.DevelInfo /// </summary> public virtual void DebugConnection() { string preffix = " "; if (Adaptor.FinalTarget == null) { return; } string s = "Control=" + Control + " Target=" + Adaptor.FinalTarget; if (TypeValidator.IsCompatible(Adaptor.FinalTarget.GetType(), typeof(IAdaptor)) == true) { IAdaptor a = (IAdaptor)Adaptor.FinalTarget; while (TypeValidator.IsCompatible(a.GetType(), typeof(IAdaptor)) == true) { if (a.Control == null) { s = s + "\n" + preffix + "Control=[POINTER] Target=" + a.FinalTarget; } else { s = s + "\n" + preffix + "Control=" + a.Control + " Target=" + a.FinalTarget; } preffix += " "; } s = s + "\n" + preffix + "Control=" + a.Control + " Target=" + a.FinalTarget; } Debug.DevelInfo("ControlAdaptor.DebugConnection (" + Control + ")", s); }
public FileAnalyser( IGlasswallFileOperations glasswallFileOperations, IAdaptor <ContentManagementFlags, string> glasswallConfigurationAdaptor) { _glasswallFileOperations = glasswallFileOperations ?? throw new ArgumentNullException(nameof(glasswallFileOperations)); _glasswallConfigurationAdaptor = glasswallConfigurationAdaptor ?? throw new ArgumentNullException(nameof(glasswallConfigurationAdaptor)); }
/// <summary> /// Creates ControlAdaptor /// </summary> /// <param name="aControl"> /// Control being controlled <see cref="System.Object"/> /// </param> /// <param name="aSingleMapping"> /// true if control allows only one single mapping <see cref="System.Boolean"/> /// </param> /// <param name="aDataSource"> /// DataSource to be connected with adaptor <see cref="System.Object"/> /// </param> /// <param name="aMappings"> /// Mappings associated by this adaptor <see cref="System.String"/> /// </param> public ControlAdaptor(object aControl, bool aSingleMapping, object aDataSource, string aMappings) { if (ValidateControlType(aControl) == false) { throw new ExceptionControlAdaptorConnectedWithWrongWidgetType(this, aControl); } control = new WeakReference(aControl); if (control.Target != null) { ConnectControlEvents(); } if ((aControl is IAdaptableContainer) || (aControl is IAdaptableObjectReader)) { adaptor = CreateAdaptorInstance(false, aControl, aSingleMapping); } else { adaptor = null; } if (IsBoundaryAdaptorAllowed() == true) { boundaryAdaptor = CreateAdaptorInstance(true, aControl, false); } else { boundaryAdaptor = null; } DataSource = aDataSource; Mappings = aMappings; }
/// <summary> /// Creates ActionController and maps Visibility and sensitivity /// </summary> /// <param name="aVisibilityMapping"> /// Property mapped to Visibility <see cref="System.String"/> /// </param> /// <param name="aSensitivityMapping"> /// Property mapped to Sensitivity <see cref="System.String"/> /// </param> /// <param name="aActions"> /// List of actions to control <see cref="ActionMonitor"/> /// </param> public ActionController(object aDataSource, string aVisibilityMapping, string aSensitivityMapping, params ActionMonitor[] aActions) { adaptor = new GtkAdaptor(); adaptor.DataChanged += GetDataFromDataSource; adaptor.TargetChanged += TargetChanged; sensitiveMapping = aSensitivityMapping; visibleMapping = aVisibilityMapping; foreach (ActionMonitor action in aActions) { if ((object)action != null) { if (action.IsValid == true) { Add(action); //System.Console.WriteLine(action.Action.Name); } } } adaptor.Mappings = GetMapping(); adaptor.Target = aDataSource; GetDataFromDataSource(this); }
/// <summary> /// Unlink mappings in connected Adaptor /// </summary> public void Disconnect() { destroyInProgress = true; if (control != null) { DisconnectControlEvents(); } customGetData = null; customPostData = null; destroyed = true; if (adaptor != null) { adaptor.DestroyInProgress = true; adaptor.Disconnect(); adaptor = null; } if (boundaryAdaptor != null) { boundaryAdaptor.DestroyInProgress = true; BoundaryDataSource = null; boundaryAdaptor.Disconnect(); boundaryAdaptor = null; } control = null; }
private void _TargetChanged(IAdaptor aAdaptor) { Gtk.Application.Invoke(delegate { if (adaptor != null && adaptor.Adaptor != null) { if ((adaptor.Adaptor.FinalTarget == null) || (adaptor.Values.Count == 0) || (adaptor.Values[0].Name == "")) { string cachedDefault = ""; if (adaptor.Adaptor.DataSourceType != null) { cachedDefault = adaptor.Values[0].ResolveTitle(adaptor.Adaptor.DataSourceType); } if (AutomaticTitle) { Label = cachedDefault; } return; } if (AutomaticTitle) { Label = adaptor.Values[0].Title; } } }); }
/// <summary> /// Auto connects properties with controls based on the same name /// /// AutoConnect() should be called after DataSource is specified. After this /// only special bindings should be specified /// </summary> public static void AutoConnect(IAdaptor aAdaptor) { if (aAdaptor != null) { aAdaptor.AutoConnect(); } }
public FileProtector(IGlasswallFileOperations glasswallFileOperations, IAdaptor <ContentManagementFlags, string> glasswallConfigurationAdaptor, ILogger <FileProtector> logger) { _glasswallFileOperations = glasswallFileOperations ?? throw new ArgumentNullException(nameof(glasswallFileOperations)); _glasswallConfigurationAdaptor = glasswallConfigurationAdaptor ?? throw new ArgumentNullException(nameof(glasswallConfigurationAdaptor)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <summary> /// Creates ValueList /// </summary> /// <param name="aAdaptor"> /// Adaptor owner <see cref="IAdaptor"/> /// </param> public ValueList(IAdaptor aAdaptor) { if (aAdaptor == null) { throw new ExceptionValueListAdaptorIsNull(); } adaptor = new WeakReference(aAdaptor); }
/// <summary> /// Adds object to registry or connects events with Adaptor if object is /// supporting interface IObserveable /// /// If DataSource is IObserveable then it will be bypassing registry all the time /// </summary> public static bool Add(object aDataSource, IAdaptor aAdaptor, EApplyMethod aInstant) { if (aDataSource is IDataAdaptor) { return(Add((aDataSource as IDataAdaptor).FinalTarget, aAdaptor, aInstant)); } if (aDataSource is IObserveable) { // If target is IObserveable then there's no need to enter it into the registry // it can handle all on its own, so connection is made to him directly if (aAdaptor.IsBoundaryAdaptor == false) { (aDataSource as IObserveable).PostRequested += aAdaptor.PostMethod; (aDataSource as IObserveable).DataChanged += aAdaptor.AdapteeDataChanged; } else { (aDataSource as IObserveable).DataChanged += aAdaptor.BoundaryAdapteeDataChanged; } } else { IObserveable ob = GetInfoFor(aDataSource); if (ob != null) { DataSourceInfo ds = (DataSourceInfo)ob; if (aAdaptor.IsBoundaryAdaptor == false) { ds.PostRequested += aAdaptor.PostMethod; ds.DataChanged += aAdaptor.AdapteeDataChanged; } else { ds.DataChanged += aAdaptor.BoundaryAdapteeDataChanged; } // Count direct adaptors only, ignore indirect if ((aAdaptor.Target is IAdaptor) == false) { ds.RefCount += 1; } ds = null; return(true); } DataSourceInfo nds = new DataSourceInfo(aDataSource, aInstant); if (aAdaptor.IsBoundaryAdaptor == false) { nds.PostRequested += aAdaptor.PostMethod; nds.DataChanged += aAdaptor.AdapteeDataChanged; } else { nds.DataChanged += aAdaptor.BoundaryAdapteeDataChanged; } datasources.Add(nds); nds = null; } return(true); }
void Awake() { // Extract the IAdaptorBtc from the game object assigned in inspector (necessary since Unity doesnt show interfaces in inspector) _iAdaptor = IAdaptorGO.GetComponent <IAdaptorBtc>(); if (_iAdaptor == null) { Msg.LogError("Cannot find IAdaptorBtc"); } }
/// <summary> /// Resolves target for given adaptor /// </summary> /// <param name="aAdaptor"> /// Adaptor from which to resolve target <see cref="IAdaptor"/> /// </param> /// <returns> /// Object to which adaptor is pointing <see cref="System.Object"/> /// </returns> public static object ResolveTargetFor(IAdaptor aAdaptor) { if (aAdaptor == null) { return(null); } // return (ResolveTargetForObject (aAdaptor.FinalTarget)); return(ResolveTargetForObject(aAdaptor.Target)); }
/// <summary> /// Activated whenever Target in Adaptor changes /// </summary> protected void TargetChanged(IAdaptor aAdaptor) { hint = NullValue; title = NullValue; #if NEWCACHE Reset(); #endif #if OLDCACHE cached = false; cachedInfo = null; #endif }
/// <summary> /// Disconnects ActionController /// </summary> protected void Disconnect() { adaptor.DataChanged -= null; adaptor.TargetChanged -= null; adaptor.Disconnect(); for (int i = 0; i < actions.Count; i++) { actions[i] = null; } actions = null; adaptor = null; }
internal Server(IAdaptor adaptor, X509Certificate2 cert) { this.adaptor = adaptor; this.middlewares = new List <IMiddleware>(); this.config = new Config(); if (cert != null) { this.isHttps = true; this.cert = cert; } }
// for Test SequenceFile GenerateTestSequenceFile() { SequenceFile seqFile = new SequenceFile(); seqFile.Name = "TestSequenceFile"; seqFile.Description = "This is a test sequenceFile."; seqFile.Comment = "Nothing"; seqFile.Version.MarjorVersion = "1"; ISequence mainSequence = SequenceFactory.CreateSequence(SequenceTypes.Normal); mainSequence.Name = "MainSequence1"; mainSequence.Description = "Main sequence for test."; mainSequence.EnableLogging = false; mainSequence.TestTimeout = 3000; mainSequence.BreakPoint = true; IStep actionStep = StepFactory.CreateStep(StepTypes.Action); actionStep.Name = "Action step test"; actionStep.Description = "this is a test action step"; IAdaptor adaptor = AdaptorFactory.CreateAdaptor(AdaptorTypes.DotnetAdaptor); adaptor.MethodName = "Test"; adaptor.TestModuleName = "DotNetTest.dll"; adaptor.Parameters.Add(new DotNetParameter()); adaptor.Parameters.Add(new DotNetParameter("parameter1")); adaptor.Parameters.Add(new DotNetParameter("parameter2")); actionStep.Adaptor = adaptor; IStep subActionStep = StepFactory.CreateStep(StepTypes.Action); subActionStep.Name = "SubAction step test"; subActionStep.Description = "this is a sub test action step"; actionStep.Children.Add(subActionStep); mainSequence.Children.Add(actionStep); mainSequence.Children.Add(subActionStep); mainSequence.Children.Add(subActionStep); ISequence mainSequence2 = SequenceFactory.CreateSequence(SequenceTypes.Normal); mainSequence2.Name = "MainSequence2"; mainSequence2.Description = "Main sequence 2 for test."; mainSequence2.EnableLogging = false; mainSequence2.TestTimeout = 3000; mainSequence2.BreakPoint = true; seqFile.Sequences.Add(mainSequence); seqFile.Sequences.Add(mainSequence2); return(seqFile); }
/// <summary> /// Takes care of disconnecting control and Adaptor /// </summary> /// <param name="aControl"> /// Control that needs disconnection <see cref="System.Object"/> /// </param> /// <param name="aAdaptor"> /// Adaptor to disconnect from control <see cref="IAdaptor"/> /// </param> /// <returns> /// true if successful <see cref="System.Boolean"/> /// </returns> public static bool DisconnectControlAndAdaptor(object aControl, IAdaptor aAdaptor) { if ((aControl == null) || (aAdaptor == null)) { return(false); } if (aControl is IAdaptableControl) { // aAdaptor.OnDataChange -= (aControl as IAdaptableControl).Adaptor.AdapteeDataChange; // aAdaptor.OnDataChange -= (aControl as IAdaptableControl).GetDataFromDataSource; aAdaptor.DataChanged -= (aControl as IAdaptableControl).CallAdaptorGetData; } return(true); }
internal DataLinker(EBindDirection aDirection, object aObj1, string aPropName1, object aObj2, string aPropName2) { active = false; source = new Adaptor(); destination = new Adaptor(); source.DataChanged += SourceDataChanged; source.TargetChanged += SourceTargetChanged; destination.DataChanged += DestinationDataChanged; destination.TargetChanged += DestinationTargetChanged; source.Target = aObj1; destination.Target = aObj2; source.Mappings = aPropName1; destination.Mappings = aPropName2; active = true; TransferData(source, destination); }
/// <summary> /// Creates Mapped property /// </summary> /// <param name="aAdaptor"> /// Adaptor mapped property is connected to <see cref="IAdaptor"/> /// </param> /// <param name="aName"> /// Name of mapped property <see cref="System.String"/> /// </param> public MappedProperty(IAdaptor aAdaptor, string aName) { // Default Mapped property if (aAdaptor == null) { throw new ExceptionMappedPropertyWithNullAdaptor(); } adaptor = new WeakReference(aAdaptor); if (Adaptor.IsBoundaryAdaptor == true) { throw new ExceptionNonBoundaryMappingSetToBoundary(aName); } Name = aName; RWFlags = EReadWrite.ReadWrite; originalRWFlags = RWFlags; Resolve(); }
/// <summary> /// Handles event whenever target changes /// </summary> /// <param name="aAdaptor"> /// Adaptor <see cref="IAdaptor"/> /// </param> private void HandleTargetChanged(IAdaptor aAdaptor) { if (adaptor == null) { return; } if (adaptor.DestroyInProgress == true) { return; } if ((internalAdaptor.Mappings == "") || (internalAdaptor.Mapping(0) == null)) { DataWidget = null; return; } System.Type type = null; if (Adaptor.Adaptor.FinalTarget == null) { if (Adaptor.Adaptor.DataSourceType == null) { DataWidget = null; return; } type = Adaptor.Adaptor.DataSourceType; } else { type = Adaptor.Adaptor.FinalTarget.GetType(); } FactoryInvocationArgs args; PropertyDefinition def = internalAdaptor.Mapping(0).OriginalRWFlags.GetPropertyDefinition(); if (Editable == false) { def = PropertyDefinition.ReadOnly; } args = new GtkFactoryInvocationArgs(def, type, internalAdaptor.Mapping(0).Name); args.AddDefaultTheme(); if ((WidgetFilter.Trim() != "") && (WidgetFilter.Trim().ToLower() != "gtk")) { args.AddFilter(WidgetFilter); } DataWidget = GtkWidgetFactory.CreateWidget(args); }
/// <summary> /// Adds Adaptor in adaptor list as a WeakReference /// </summary> public static void AddAdaptor(IAdaptor aAdaptor) { if (aAdaptor == null) { return; } WeakReference wr = new WeakReference(aAdaptor); // Separate boundary and non-boundary for speed if (aAdaptor.IsBoundaryAdaptor == true) { boundaryadaptorList.Add(wr); } else { adaptorList.Add(wr); } }
/// <summary> /// Creates ActionController /// </summary> /// <param name="aActions"> /// List of actions to control <see cref="ActionMonitor"/> /// </param> public ActionController(params ActionMonitor[] aActions) { adaptor = new GtkAdaptor(); adaptor.DataChanged += GetDataFromDataSource; adaptor.TargetChanged += TargetChanged; foreach (ActionMonitor action in aActions) { if ((object)action != null) { if (action.IsValid == true) { Add(action); } } } GetDataFromDataSource(this); }
/// <summary> /// Use the inspector enum to refresh the internal adaptor object that is used by code /// </summary> private void RefreshChosenAdaptorObject() { var allAdaptors = this.GetComponents <IAdaptor>(); for (int i = 0; i < allAdaptors.GetLength(0); i++) { string s = allAdaptors[i].ToString(); if (ChosenAdaptor == AvailableAdaptor.AdaptorBtcDotInfo && s.Contains("AdaptorBtcDotInfo")) // I cant remember why this is doing two checks { Msg.Log("AdaptorSelector.RefreshChosenAdaptorObject sets adaptor to AdaptorBtcDotInfo"); _chosenAdaptorObject = allAdaptors[i]; } else if (ChosenAdaptor == AvailableAdaptor.AdaptorBtcOfflineFiles && s.Contains("AdaptorBtcOfflineFiles")) { Msg.Log("AdaptorSelector.RefreshChosenAdaptorObject sets adaptor to AdaptorBtcOfflineFiles"); _chosenAdaptorObject = allAdaptors[i]; } } }
/// <summary> /// Creates ControlAdaptor with custom created Adaptors /// </summary> /// <param name="aControl"> /// Control to be connected with <see cref="System.Object"/> /// </param> /// <param name="aAdaptor"> /// Data adaptor <see cref="IAdaptor"/> /// </param> /// <param name="aBoundaryAdaptor"> /// Boundary adaptor <see cref="IAdaptor"/> /// </param> public ControlAdaptor(object aControl, IAdaptor aAdaptor, IAdaptor aBoundaryAdaptor) { if (ValidateControlType(aControl) == false) { throw new ExceptionControlAdaptorConnectedWithWrongWidgetType(this, aControl); } control = new WeakReference(aControl); if (control.Target != null) { ConnectControlEvents(); } adaptor = aAdaptor; if (IsBoundaryAdaptorAllowed() == true) { boundaryAdaptor = aBoundaryAdaptor; } else { boundaryAdaptor = null; } }
/// <summary> /// Removes WeakReference for Adaptor from the list /// </summary> public static void RemoveAdaptor(IAdaptor aAdaptor) { int i; if ((aAdaptor == null) || (AdaptorCount <= 0)) { return; } // Separate boundary and non-boundary for speed if (aAdaptor.IsBoundaryAdaptor == true) { for (i = 0; i < boundaryadaptorList.Count; i++) { lock (boundaryadaptorList) { if (((WeakReference)boundaryadaptorList[i]).Target == aAdaptor) { ((WeakReference)boundaryadaptorList[i]).Target = null; boundaryadaptorList[i] = null; boundaryadaptorList.RemoveAt(i); return; } } } } else { for (i = 0; i < AdaptorCount; i++) { lock (adaptorList) { if (((WeakReference)adaptorList[i]).Target == aAdaptor) { ((WeakReference)adaptorList[i]).Target = null; adaptorList[i] = null; adaptorList.RemoveAt(i); return; } } } } }
/// <summary> /// Creates Mapped property /// </summary> /// <param name="aAdaptor"> /// Adaptor mapped property is connected to <see cref="IAdaptor"/> /// </param> /// <param name="aName"> /// Name of mapped property <see cref="System.String"/> /// </param> /// <param name="aRWFlags"> /// Read write flags <see cref="EReadWrite"/> /// </param> /// <param name="aTarget"> /// Target mapping <see cref="System.String"/> /// </param> public MappedProperty(IAdaptor aAdaptor, string aName, EReadWrite aRWFlags, string aTarget) { // Secondary Mapped property if (aAdaptor == null) { throw new ExceptionMappedPropertyWithNullAdaptor(); } adaptor = new WeakReference(aAdaptor); if (Adaptor.IsBoundaryAdaptor == true) { throw new ExceptionNonBoundaryMappingSetToBoundary(aName, aTarget); } Name = aName; mappingTarget = aTarget; originalRWFlags = aRWFlags; RWFlags = aRWFlags; if (aTarget == "") { throw new ExceptionMappingRequiresDefinedTarget(aName); } Resolve(); }
/// <summary> /// Transfers data between source and destination object /// </summary> /// <param name="aSrc"> /// Object where source data resides <see cref="IAdaptor"/> /// </param> /// <param name="aDest"> /// Object which will get new data <see cref="IAdaptor"/> /// </param> public void TransferData(IAdaptor aSrc, IAdaptor aDest) { if ((aSrc.FinalTarget == null) || (aDest.FinalTarget == null)) { return; } if ((aSrc.Mappings == "") || (aDest.Mappings == "")) { return; } if ((aSrc.FinalTarget == aDest.FinalTarget) && (aSrc.Mappings == aDest.Mappings)) { return; } try { aDest.ExecuteUserMethod(delegate { aDest.SetDefaultMappingValue(aSrc.GetDefaultMappingValue()); }); } catch { throw new Exception("Error transfering data in DataLinker"); } }
/// <summary> /// Notifies all connected parties about new Target /// /// The only ones connected here are ControlAdaptor types which took care /// of the controls /// </summary> /// <param name="aAdaptor"> /// Calling adaptor <see cref="IAdaptor"/> /// </param> public void DestinationTargetChanged(IAdaptor aAdaptor) { if (Active == false) { return; } if (destination.FinalTarget != null) { // Check if this Adaptor is optimal for this type or remake it IAdaptorSelector sel = AdaptorSelector.GetCorrectAdaptor(aAdaptor.FinalTarget); if (destination.GetType() != sel.GetAdaptorType()) { IAdaptor newdest = sel.CreateAdaptor(); newdest.Target = destination.Target; newdest.Mappings = destination.Mappings; newdest.DataChanged += DestinationDataChanged; newdest.TargetChanged += DestinationTargetChanged; destination.Disconnect(); destination = newdest; } } TransferData(source, destination); }
public ExceptionDataSourceTypeWasNotSpecified (System.Type aType, IAdaptor aAdaptor) : base ("DataSource Type constriction was not specified in mapping in (" + aType + ")") { }
/// <summary> /// Creates GtkControlAdaptor /// </summary> /// <param name="aControl"> /// Control where this Adaptor is connected to <see cref="System.Object"/> /// </param> /// <param name="aAdaptor"> /// Custom created Adaptor to be connected with this one <see cref="IAdaptor"/> /// </param> /// <param name="aBoundaryAdaptor"> /// Custom created BoundaryAdaptor to be connected with this one <see cref="IAdaptor"/> /// </param> /// <param name="aDataSource"> /// DataSource connected to this Adaptor <see cref="System.Object"/> /// </param> /// <param name="aMappings"> /// Mappings string <see cref="System.String"/> /// </param> public GtkControlAdaptor (object aControl, IAdaptor aAdaptor, IAdaptor aBoundaryAdaptor, object aDataSource, string aMappings) : base (aControl, aAdaptor, aBoundaryAdaptor, aDataSource, aMappings) { }
/// <summary> /// Creates GtkControlAdaptor /// </summary> /// <param name="aControl"> /// Control where this Adaptor is connected to <see cref="System.Object"/> /// </param> /// <param name="aAdaptor"> /// Custom created Adaptor to be connected with this one <see cref="IAdaptor"/> /// </param> /// <param name="aBoundaryAdaptor"> /// Custom created BoundaryAdaptor to be connected with this one <see cref="IAdaptor"/> /// </param> public GtkControlAdaptor (object aControl, IAdaptor aAdaptor, IAdaptor aBoundaryAdaptor) : base (aControl, aAdaptor, aBoundaryAdaptor) { }
/// <summary> /// Creates Mapped property /// </summary> /// <param name="aAdaptor"> /// Adaptor mapped property is connected to <see cref="IAdaptor"/> /// </param> /// <param name="aIsColumn"> /// Defines if this is column or not <see cref="System.Boolean"/> /// </param> /// <param name="aName"> /// Name of mapped property <see cref="System.String"/> /// </param> /// <param name="aColumnName"> /// Name of column <see cref="System.String"/> /// </param> /// <param name="aRWFlags"> /// Read write flags <see cref="EReadWrite"/> /// </param> /// <param name="aTarget"> /// Target mapping <see cref="System.String"/> /// </param> /// <param name="aSubItems"> /// Sub items <see cref="SMappedItem"/> /// </param> public MappedProperty (IAdaptor aAdaptor, bool aIsColumn, string aName, string aColumnName, EReadWrite aRWFlags, string aTarget, SMappedItem[] aSubItems) { // Targeted Column Mapped property if (aAdaptor == null) throw new ExceptionMappedPropertyWithNullAdaptor(); adaptor = new WeakReference (aAdaptor); if (Adaptor.IsBoundaryAdaptor == true) throw new ExceptionNonBoundaryMappingSetToBoundary (aName, aTarget, aColumnName); Name = aName; submappings = new ChildMappedProperties(); mappingTarget = aTarget; IsColumnMapping = aIsColumn; if (IsColumnMapping == true) submappings = new ChildMappedProperties(); ColumnName = aColumnName; originalRWFlags = aRWFlags; RWFlags = aRWFlags; if (aSubItems != null) foreach (SMappedItem item in aSubItems) Submappings.AddMapping (new MappedProperty (this, item)); if (aTarget == "") throw new ExceptionMappingRequiresDefinedTarget (aName); Resolve(); }
/// <summary> /// Creates Mapped property /// </summary> /// <param name="aAdaptor"> /// Adaptor mapped property is connected to <see cref="IAdaptor"/> /// </param> /// <param name="aIsColumn"> /// Defines if this is column or not <see cref="System.Boolean"/> /// </param> /// <param name="aName"> /// Name of mapped property <see cref="System.String"/> /// </param> /// <param name="aColumnName"> /// Name of column <see cref="System.String"/> /// </param> /// <param name="aRWFlags"> /// Read write flags <see cref="EReadWrite"/> /// </param> /// <param name="aSubItems"> /// Sub items <see cref="SMappedItem"/> /// </param> public MappedProperty (IAdaptor aAdaptor, bool aIsColumn, string aName, string aColumnName, EReadWrite aRWFlags, SMappedItem[] aSubItems) { // Column Mapped property if (aAdaptor == null) throw new ExceptionMappedPropertyWithNullAdaptor(); submappings = new ChildMappedProperties(); adaptor = new WeakReference (aAdaptor); if (Adaptor.IsBoundaryAdaptor == true) throw new ExceptionNonBoundaryMappingSetToBoundary (aName, true, aColumnName); Name = aName; IsColumnMapping = aIsColumn; originalRWFlags = aRWFlags; RWFlags = aRWFlags; if (IsColumnMapping == true) submappings = new ChildMappedProperties(); if (aSubItems != null) { Submappings.Size = aSubItems.Length; foreach (SMappedItem item in aSubItems) Submappings.AddMapping (new MappedProperty (this, item)); } ColumnName = aColumnName; Resolve(); }
/// <summary> /// Creates Mapped property /// </summary> /// <param name="aAdaptor"> /// Adaptor mapped property is connected to <see cref="IAdaptor"/> /// </param> /// <param name="aName"> /// Name of mapped property <see cref="System.String"/> /// </param> /// <param name="aRWFlags"> /// Read write flags <see cref="EReadWrite"/> /// </param> /// <param name="aTarget"> /// Target mapping <see cref="System.String"/> /// </param> public MappedProperty (IAdaptor aAdaptor, string aName, EReadWrite aRWFlags, string aTarget) { // Secondary Mapped property if (aAdaptor == null) throw new ExceptionMappedPropertyWithNullAdaptor(); adaptor = new WeakReference (aAdaptor); if (Adaptor.IsBoundaryAdaptor == true) throw new ExceptionNonBoundaryMappingSetToBoundary (aName, aTarget); Name = aName; mappingTarget = aTarget; originalRWFlags = aRWFlags; RWFlags = aRWFlags; if (aTarget == "") throw new ExceptionMappingRequiresDefinedTarget (aName); Resolve(); }
/// <summary> /// Handles event whenever target changes /// </summary> /// <param name="aAdaptor"> /// Adaptor <see cref="IAdaptor"/> /// </param> private void HandleTargetChanged (IAdaptor aAdaptor) { if (adaptor == null) return; if (adaptor.DestroyInProgress == true) return; if ((internalAdaptor.Mappings == "") || (internalAdaptor.Mapping(0) == null)) { DataWidget = null; return; } System.Type type = null; if (Adaptor.Adaptor.FinalTarget == null) { if (Adaptor.Adaptor.DataSourceType == null) { DataWidget = null; return; } type = Adaptor.Adaptor.DataSourceType; } else type = Adaptor.Adaptor.FinalTarget.GetType(); FactoryInvocationArgs args; PropertyDefinition def = internalAdaptor.Mapping(0).OriginalRWFlags.GetPropertyDefinition(); if (Editable == false) def = PropertyDefinition.ReadOnly; args = new GtkFactoryInvocationArgs (def, type, internalAdaptor.Mapping(0).Name); args.AddDefaultTheme(); if ((WidgetFilter.Trim() != "") && (WidgetFilter.Trim().ToLower() != "gtk")) args.AddFilter (WidgetFilter); DataWidget = GtkWidgetFactory.CreateWidget (args); }
/// <summary> /// construct /// </summary> /// <param name="intermediaryAdaptor"></param> /// <param name="intermediaryProductService"></param> /// <param name="ownerRepository"></param> public MortgageModellingService(IAdaptor intermediaryAdaptor, IOwnerRepository ownerRepository) { _IntermediaryAdaptor = intermediaryAdaptor; _ownerRepository = ownerRepository; return; }
/// <summary> /// Takes care of disconnecting control and Adaptor /// </summary> /// <param name="aControl"> /// Control that needs disconnection <see cref="System.Object"/> /// </param> /// <param name="aAdaptor"> /// Adaptor to disconnect from control <see cref="IAdaptor"/> /// </param> /// <returns> /// true if successful <see cref="System.Boolean"/> /// </returns> public static bool DisconnectControlAndAdaptor (object aControl, IAdaptor aAdaptor) { if ((aControl == null) || (aAdaptor == null)) return (false); if (aControl is IAdaptableControl) // aAdaptor.OnDataChange -= (aControl as IAdaptableControl).Adaptor.AdapteeDataChange; // aAdaptor.OnDataChange -= (aControl as IAdaptableControl).GetDataFromDataSource; aAdaptor.DataChanged -= (aControl as IAdaptableControl).CallAdaptorGetData; return (true); }
/// <summary> /// Notifies all connected parties about new Target /// /// The only ones connected here are ControlAdaptor types which took care /// of the controls /// </summary> protected void OnTargetChanged (IAdaptor aSender) { if (insideReparenting == true) return; if (destroyInProgress == true) return; insideReparenting = true; finalTarget.Target = null; isValidated = false; GetFinalTarget(); if (lastFinalTarget != null) { if (finalTarget.Target == lastFinalTarget.Target) { insideReparenting = false; return; } else lastFinalTarget.Target = finalTarget.Target; } else lastFinalTarget = new WeakReference (finalTarget.Target); if (targetChanged != null) targetChanged (aSender); insideReparenting = false; }
/// <summary> /// Internal method which handles target change and sets new title /// </summary> /// <param name="aAdaptor"> /// Adaptor <see cref="IAdaptor"/> /// </param> private void _TargetChanged (IAdaptor aAdaptor) { Gtk.Application.Invoke (delegate { GetDataFromDataSource (null); }); }
/// <summary> /// Creates MappedPropertyEnumerator /// </summary> /// <returns> /// Adaptor owner <see cref="IAdaptor"/> /// </returns> public MappedPropertyEnumerator (IAdaptor aMaster) { master = aMaster; }
/// <summary> /// Creates ValueList /// </summary> /// <param name="aAdaptor"> /// Adaptor owner <see cref="IAdaptor"/> /// </param> public ValueList (IAdaptor aAdaptor) { if (aAdaptor == null) throw new ExceptionValueListAdaptorIsNull(); adaptor = new WeakReference (aAdaptor); }
/// <summary> /// Creates Mapped property /// </summary> /// <param name="aAdaptor"> /// Adaptor mapped property is connected to <see cref="IAdaptor"/> /// </param> /// <param name="aName"> /// Name of mapped property <see cref="System.String"/> /// </param> public MappedProperty (IAdaptor aAdaptor, string aName) { // Default Mapped property if (aAdaptor == null) throw new ExceptionMappedPropertyWithNullAdaptor(); adaptor = new WeakReference (aAdaptor); if (Adaptor.IsBoundaryAdaptor == true) throw new ExceptionNonBoundaryMappingSetToBoundary (aName); Name = aName; RWFlags = EReadWrite.ReadWrite; originalRWFlags = RWFlags; Resolve(); }
/// <summary> /// Sets non global /// </summary> /// <param name="aAdaptor"> /// Adaptor to set boundary values for <see cref="IAdaptor"/> /// </param> /// <param name="aControl"> /// Control to set properties for <see cref="System.Object"/> /// </param> public void SetBoundaryMappingValues (IAdaptor aAdaptor, object aControl) { if ((aAdaptor == null) || (aControl == null)) return; if (aAdaptor.IsBoundaryAdaptor == false) throw new ExceptionNonBoundaryAdaptorConnectedToBoundaryEvent(); foreach (MappedProperty mp in aAdaptor.Values) if (mp != null) if (mp.IsGlobal == false) mp.AssignValueToObject (EDataDirection.FromDataSourceToControl, FinalTarget, aControl); }
/// <summary> /// Activated whenever Target in Adaptor changes /// </summary> protected void TargetChanged (IAdaptor aAdaptor) { hint = NullValue; title = NullValue; #if NEWCACHE Reset(); #endif #if OLDCACHE cached = false; cachedInfo = null; #endif }
/// <summary> /// Notifies all connected parties about new Target /// /// The only ones connected here are ControlAdaptor types which took care /// of the controls /// </summary> /// <param name="aAdaptor"> /// Calling adaptor <see cref="IAdaptor"/> /// </param> public void AdaptorTargetChanged (IAdaptor aAdaptor) { OnTargetChanged (this); }
/// <summary> /// Resolves target for given adaptor /// </summary> /// <param name="aAdaptor"> /// Adaptor from which to resolve target <see cref="IAdaptor"/> /// </param> /// <returns> /// Object to which adaptor is pointing <see cref="System.Object"/> /// </returns> public static object ResolveTargetFor (IAdaptor aAdaptor) { if (aAdaptor == null) return (null); // return (ResolveTargetForObject (aAdaptor.FinalTarget)); return (ResolveTargetForObject (aAdaptor.Target)); }