Пример #1
0
        private bool OnWindowCreated(byte[] newVal)
        {
            if (ElementWdwPtr.Read <int>() == 0)
            {
                return(false);
            }

            ElementIdPtr        = SMProcess[SM17Natives.TElWind.ElementIdPtr];
            CurrentConceptIdPtr = SMProcess[SM17Natives.Globals.CurrentConceptIdPtr];
            CurrentRootIdPtr    = SMProcess[SM17Natives.Globals.CurrentRootIdPtr];
            CurrentHookIdPtr    = SMProcess[SM17Natives.Globals.CurrentHookIdPtr];

            ElementIdPtr.RegisterValueChangedEventHandler <int>(OnElementChangedInternal);

            LastElementId = CurrentElementId;

            // TODO: ??? This somehow gets delayed and causes all sorts of troubles
            //OnElementChanged?.Invoke(new SMDisplayedElementChangedArgs(SMA.Instance,
            //                                                   CurrentElement,
            //                                                   null));

            OnAvailable?.Invoke();

            return(true);
        }
Пример #2
0
        private bool OnWindowCreated(byte[] newVal)
        {
            if (ElementWdwPtr.Read <int>() == 0)
            {
                return(false);
            }

            ElementIdPtr             = SMProcess[Core.Natives.ElWind.ElementIdPtr];
            LimitChildrenCountPtr    = SMProcess[Core.Natives.Globals.LimitChildrenCountPtr];
            CurrentConceptIdPtr      = SMProcess[Core.Natives.Globals.CurrentConceptIdPtr];
            CurrentConceptGroupIdPtr = SMProcess[Core.Natives.Globals.CurrentConceptGroupIdPtr];
            CurrentRootIdPtr         = SMProcess[Core.Natives.Globals.CurrentRootIdPtr];
            CurrentHookIdPtr         = SMProcess[Core.Natives.Globals.CurrentHookIdPtr];
            LearningModePtr          = SMProcess[Core.Natives.ElWind.LearningModePtr];

            ElementIdPtr.RegisterValueChangedEventHandler <int>(OnElementChangedInternal);

            LastElementId = CurrentElementId;

            // TODO: ??? This somehow gets delayed and causes all sorts of troubles
            //OnElementChanged?.Invoke(new SMDisplayedElementChangedEventArgs(SMA.Instance,
            //                                                   CurrentElement,
            //                                                   null));

            IsAvailable = true;

            OnAvailableInternal?.Invoke();

            OnAvailable?.InvokeRemote(
                nameof(OnAvailable),
                h => OnAvailable -= h
                );

            return(true);
        }
Пример #3
0
        /// <inheritdoc />
        public void Dispose()
        {
            LogTo.Debug("Cleaning up {Name}", GetType().Name);

            _controlGroup?.Dispose();
            SMMainWdwPtr?.Dispose();
            ElementWdwPtr?.Dispose();
            ElementIdPtr?.Dispose();
            CurrentConceptIdPtr?.Dispose();
            CurrentConceptGroupIdPtr?.Dispose();
            CurrentRootIdPtr?.Dispose();
            CurrentHookIdPtr?.Dispose();
            LearningModePtr?.Dispose();

            SMMainWdwPtr             = null;
            ElementWdwPtr            = null;
            ElementIdPtr             = null;
            CurrentConceptIdPtr      = null;
            CurrentConceptGroupIdPtr = null;
            CurrentRootIdPtr         = null;
            CurrentHookIdPtr         = null;
            LearningModePtr          = null;

            LogTo.Debug("Cleaning up {Name}... Done", GetType().Name);
        }
Пример #4
0
        private void OnSMStoppedEvent(object sender,
                                      SMProcessArgs e)
        {
            ElementIdPtr.Dispose();

            ElementWdwPtr       = null;
            ElementIdPtr        = null;
            CurrentConceptIdPtr = null;
            CurrentRootIdPtr    = null;
            CurrentHookIdPtr    = null;
        }
Пример #5
0
        private Task OnSMStoppedEvent(object sender,
                                      SMProcessArgs e)
        {
            LogTo.Debug($"Cleaning up {GetType().Name}");

            ElementIdPtr?.Dispose();

            ElementWdwPtr       = null;
            ElementIdPtr        = null;
            CurrentConceptIdPtr = null;
            CurrentRootIdPtr    = null;
            CurrentHookIdPtr    = null;

            return(TaskConstants.Completed);
        }
Пример #6
0
        private void OnSMStoppedEvent(object sender,
                                      SMProcessArgs e)
        {
            LogTo.Debug($"Cleaning up {GetType().Name}");

            ElementIdPtr?.Dispose();

            SMMainWdwPtr             = null;
            ElementWdwPtr            = null;
            ElementIdPtr             = null;
            CurrentConceptIdPtr      = null;
            CurrentConceptGroupIdPtr = null;
            CurrentRootIdPtr         = null;
            CurrentHookIdPtr         = null;
            LearningModePtr          = null;

            LogTo.Debug($"Cleaning up {GetType().Name}... Done");
        }
Пример #7
0
 public bool QuitSMAUpdateLock(bool updateValue = false)
 {
     return(ElementIdPtr.RestartTimer(updateValue));
 }
Пример #8
0
 public bool EnterSMAUpdateLock()
 {
     return(ElementIdPtr.SuspendTimer());
 }