private void QueueMessageHandler(IChoQueuedMsgServiceObject <ChoExecutionServiceData> msgObject) { if (msgObject == null || !ChoGuard.IsArgumentNotNullOrEmpty(msgObject.State) ) { return; } ChoAsyncResult asyncResult = msgObject.State.Result as ChoAsyncResult; try { object retValue = msgObject.State.Func.Run(msgObject.State.Parameters, msgObject.State.Timeout, msgObject.State.MaxNoOfRetry, msgObject.State.SleepBetweenRetry); asyncResult.SetAsSuccess(retValue, true); } catch (ThreadAbortException) { Thread.ResetAbort(); ChoTrace.Error("Thread aborted." + msgObject.State.ToString()); asyncResult.SetAsAborted(true); } catch (Exception ex) { ChoTrace.Error(ex); ChoTrace.Error(msgObject.State.ToString()); asyncResult.SetAsFailed(ex, true); } }
public ChoDictionary <string, ChoObjConfigurable> ConvertToDistinctDictionary(ChoObjConfigurable[] objConfigurables) { ChoDictionary <string, ChoObjConfigurable> _distinctObjectConfigurables = new ChoDictionary <string, ChoObjConfigurable>(); if (ChoGuard.IsArgumentNotNullOrEmpty(objConfigurables)) { return(_distinctObjectConfigurables); } foreach (ChoObjConfigurable objConfigurable in objConfigurables) { if (objConfigurable == null) { continue; } if (String.IsNullOrEmpty(objConfigurable.Name)) { continue; } if (_distinctObjectConfigurables.ContainsKey(objConfigurable.Name)) { ChoTrace.Debug(String.Format("Item with {0} key already exists.", objConfigurable.Name)); continue; } _distinctObjectConfigurables.Add(objConfigurable.Name, objConfigurable); } return(_distinctObjectConfigurables); }
/// <summary> /// Sets the animation clip that will be displayed in the system tray /// </summary> /// <param name="icons">The array of icons which forms each frame of the animation /// This'll work by showing one icon after another in the array. /// Each of the icons must be 16x16 pixels </param> public void SetAnimationClip(Icon[] icons) { if (ChoGuard.IsArgumentNotNullOrEmpty(icons)) { return; } _animationIcons = icons; }
private void QueueMessageHandler(IChoQueuedMsgServiceObject <string> msgObject) { if (msgObject == null || !ChoGuard.IsArgumentNotNullOrEmpty(msgObject.State)) { return; } lock (_iniDocument.SyncRoot) { File.WriteAllText(_iniDocument.Path, msgObject.State); } }
private void QueueMessageHandler(IChoQueuedMsgServiceObject <ChoStandardQueuedMsg> msgObject) { if (msgObject == null || !ChoGuard.IsArgumentNotNullOrEmpty(msgObject.State)) { return; } lock (_syncRoot) { //File.WriteAllText(Path, msgObject.State.Msg); } }
/// <summary> /// Sets the animation clip that will be displayed in the system tray /// </summary> /// <param name="icons">The array of bitmaps which forms each frame of the animation /// This'll work by showing one bitmap after another in the array. /// Each of the bitmaps must be 16x16 pixels </param> public void SetAnimationClip(Bitmap[] bitmap) { if (ChoGuard.IsArgumentNotNullOrEmpty(bitmap)) { return; } _animationIcons = new Icon[bitmap.Length]; for (int i = 0; i < bitmap.Length; i++) { _animationIcons[i] = Icon.FromHandle(bitmap[i].GetHicon()); } }
/// <summary> /// Sets the animation clip that will be displayed in the system tray /// </summary> /// <param name="icons">The bitmap strip that contains the frames of animation. /// This can be created by creating a image of size 16*n by 16 pixels /// Where n is the number of frames. Then in the first 16x16 pixel put /// first image and then from 16 to 32 pixel put the second image and so on</param> public void SetAnimationClip(Bitmap bitmapStrip) { if (ChoGuard.IsArgumentNotNullOrEmpty(bitmapStrip)) { return; } _animationIcons = new Icon[bitmapStrip.Width / 16]; for (int i = 0; i < _animationIcons.Length; i++) { Rectangle rect = new Rectangle(i * 16, 0, 16, 16); Bitmap bmp = bitmapStrip.Clone(rect, bitmapStrip.PixelFormat); _animationIcons[i] = Icon.FromHandle(bmp.GetHicon()); } }
public void LoadAssemblies(string[] directories) { if (!ChoGuard.IsArgumentNotNullOrEmpty(directories)) { return; } foreach (Assembly assembly in ChoAssembly.GetAssemblies(directories)) { if (_loadedAssemblies.ContainsKey(assembly.FullName)) { continue; } _loadedAssemblies.Add(assembly.FullName, assembly); } }
private void QueueMessageHandler(IChoQueuedMsgServiceObject <ChoExecutionServiceData> msgObject) { if (msgObject == null || !ChoGuard.IsArgumentNotNullOrEmpty(msgObject.State)) { return; } ChoAbortableAsyncResult asyncResult = msgObject.State.Result as ChoAbortableAsyncResult; if (msgObject.State.Result != null) { if (msgObject.State.Result is ChoAbortableAsyncResult && ((ChoAbortableAsyncResult)msgObject.State.Result).AbortRequested) { asyncResult.SetAsAborted(true); return; } } WaitFor(msgObject.State.Func, msgObject.State.Parameters, msgObject.State.Timeout, msgObject.State.MaxNoOfRetry, msgObject.State.SleepBetweenRetry, msgObject.State); }
public void LoadAssemblies(string[] directories) { if (!ChoGuard.IsArgumentNotNullOrEmpty(directories)) { return; } lock (_padLock) { foreach (Assembly assembly in ChoAssembly.GetAssemblies(directories)) { if (_loadedAssemblies.ContainsKey(assembly.FullName)) { continue; } _loadedAssemblies.Add(assembly.FullName, assembly); AssemblyLoaded.Raise(null, new ChoEventArgs <Assembly>(assembly)); } } }
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor defaultDescriptor = base.GetTypeDescriptor(objectType, instance); ChoTypeProviderAttribute typeProviderAttribute = ChoType.GetAttribute <ChoTypeProviderAttribute>(GetType()); if (typeProviderAttribute != null) { if (ChoGuard.IsArgumentNotNullOrEmpty(typeProviderAttribute.AdditionalConstructorParameters)) { return(ChoType.CreateInstance(typeProviderAttribute.Type, ChoArray.Combine <object>(new object[] { this, defaultDescriptor, objectType, instance }, typeProviderAttribute.AdditionalConstructorParameters)) as ICustomTypeDescriptor); } else { return(ChoType.CreateInstance(typeProviderAttribute.Type, new object[] { this, defaultDescriptor, objectType, instance }) as ICustomTypeDescriptor); } //return instance == null ? defaultDescriptor : new FieldsToPropertiesTypeDescriptor(this, defaultDescriptor, objectType); } return(defaultDescriptor); }