コード例 #1
0
        public async Task DisposeWorkplace(bool immediately = false)
        {
            if (!IsInitialized)
            {
                throw new InvalidOperationException();
            }

            // closing IDEs in reverse order
            while (IDEs.Count > 0)
            {
                await CloseIDE(IDEs.Last(), immediately);
            }

            bool locked;

            foreach (IInputDevice inputDevice in InputDevices)
            {
                if (inputDevice != null && inputDevice.IsInitialized)
                {
                    locked = false;
                    if (inputDevice.IsLockingRequiredForDispose())
                    {
                        IOmonitor.IdleForLock(inputDevice, out locked);
                    }
                    inputDevice.Dispose();
                    if (locked)
                    {
                        IOmonitor.Unlock(inputDevice);
                    }
                }
            }
            foreach (IOutputDevice outputDevice in OutputDevices)
            {
                if (outputDevice != null && outputDevice.IsInitialized)
                {
                    locked = false;
                    if (outputDevice.IsLockingRequiredForDispose())
                    {
                        IOmonitor.IdleForLock(outputDevice, out locked);
                    }
                    outputDevice.Dispose();
                    if (locked)
                    {
                        IOmonitor.Unlock(outputDevice);
                    }
                }
            }
            foreach (IExtraWorkplaceComponent extraComponent in ExtraComponents
                     .Where(e => e is IDisposable))
            {
                (extraComponent as IDisposable)?.Dispose();
            }

            IsInitialized = false;
            OnGotUpdated();
        }
コード例 #2
0
        public IExtraWorkplaceComponent NewExtraWorkplaceComponent(ComponentTypeInfo extraComponentType)
        {
            IExtraWorkplaceComponent newExtra = WorkplaceExtraBuilder.GetNew(extraComponentType);

            newExtra.ParentWorkplace = this;
            Form newExtraForm = newExtra as Form;

            if (newExtraForm != null)
            {
                newExtraForm.MdiParent    = MainForm as Form;
                newExtraForm.FormClosing += this.ExtraWorkplaceComponent_Closing;
            }
            ExtraComponents.Add(newExtra);

            if (newExtra.GetType().GetCustomAttribute <InitializeAfterCreateAttribute>()?.InitializeAfterCreate ?? false)
            {
                newExtra.Initialize(this);
            }

            return(newExtra);
        }
コード例 #3
0
        /// <summary>   Creates a new instance of AbstractType. </summary>
        ///
        /// <param name="message">      message to which this type belongs. </param>
        /// <param name="description">  The type description. </param>

        public AbstractType(IMessage message, string description)
        {
            this.extra       = new ExtraComponents(message);
            this.description = description;
            this.message     = message;
        }
コード例 #4
0
ファイル: AbstractType.cs プロジェクト: noorsyyad/nHapi
 /// <summary> Creates a new instance of AbstractType.</summary>
 /// <param name="message">message to which this type belongs.
 /// <param name="description">The type description</param>
 /// </param>
 public AbstractType(IMessage message, string description)
 {
     ExtraComponents = new ExtraComponents(message);
     Description     = description;
     Message         = message;
 }
コード例 #5
0
        // // //

        private void ExtraWorkplaceComponent_Closing(object sender, EventArgs e)
        {
            ExtraComponents.Remove(sender as IExtraWorkplaceComponent);
            (sender as IDisposable)?.Dispose();
        }