public void Dispose()
 {
     if (watchId.HasValue)
     {
         StopWatch().ContinueWith(_ => thisRef.Dispose());
     }
     else
     {
         thisRef.Dispose();
     }
 }
Beispiel #2
0
        /// <summary>
        /// after call DisableEditMode, Edit button will disappear
        /// and will need to call Initialize to re-enable edit mode again
        /// </summary>
        /// <returns></returns>
        public async Task DisableEditMode()
        {
            var module = await moduleTask.Value;
            await module.InvokeAsync <object>("destroy");

            editorHelper = new EditorHelper();
            if (helperRef != null)
            {
                helperRef.Dispose();
            }
            helperRef       = null;
            needToSetEditor = true;
        }
        protected override async Task OnParametersSetAsync()
        {
            if (Value.HasValue)
            {
                value          = Value.Value;
                _renderedValue = value;
            }
            else if (DefaultValue.HasValue && !initialValueSet)
            {
                initialValueSet = true;
                value           = DefaultValue.Value;
                _renderedValue  = value;
            }

            if (jsAvailable)
            {
                if (Disabled && dotNetObjectReference != null)
                {
                    _ = JSRuntime?.InvokeVoidAsync("BlazorFluentUiSlider.unregisterHandler", dotNetObjectReference);
                    dotNetObjectReference.Dispose();
                    dotNetObjectReference = null;
                }
                else if (!Disabled && dotNetObjectReference == null)
                {
                    dotNetObjectReference = DotNetObjectReference.Create(this);
                    await JSRuntime.InvokeVoidAsync("BlazorFluentUiSlider.registerMouseOrTouchStart", dotNetObjectReference, slideBox, sliderLine);
                }
            }

            UpdateState();

            await base.OnParametersSetAsync();
        }
Beispiel #4
0
    /// <summary>
    /// Select file(s) by browse button or drag and drop.
    /// </summary>
    /// <returns></returns>
    private async Task HandleOnChange()
    {
        if (UploadUrl is null)
        {
            return;
        }

        if (dotnetObjectReference != null)
        {
            dotnetObjectReference.Dispose();
        }

        dotnetObjectReference = DotNetObjectReference.Create(this);

        var url = AddQueryString(UploadUrl, UploadRequestQueryStrings);

        Files = await JSRuntime.InitUploader(inputFileElement, dotnetObjectReference, url, UploadRequestHttpHeaders);

        if (Files is not null)
        {
            await OnChange.InvokeAsync(Files.ToArray());
        }

        if (AutoUploadEnabled)
        {
            await Upload();
        }
    }
Beispiel #5
0
 public static void DisposeDotNetObjectRef <T>(DotNetObjectReference <T> value) where T : class
 {
     if (value != null)
     {
         value.Dispose();
     }
 }
 void IDisposable.Dispose()
 {
     if (_objectReference != null)
     {
         _objectReference.Dispose();
         _objectReference = null;
     }
 }
 public async ValueTask DisposeAsync()
 {
     if (await IsSupported())
     {
         await DeactivateEvents();
     }
     _that.Dispose();
 }
Beispiel #8
0
        public async ValueTask DisposeAsync()
        {
            _objectRef.Dispose();
            await BlazorStrap.Interop.RemoveDocumentEventAsync(this, DataRefId, EventType.Click);

            BlazorStrap.OnEventForward -= InteropEventCallback;
            GC.SuppressFinalize(this);
        }
 public void Dispose()
 {
     if (dotNetObjectRef != null)
     {
         dotNetObjectRef.Dispose();
         dotNetObjectRef = null;
     }
 }
 void IDisposable.Dispose()
 {
     JsService.RemoveCKEditor(Id);
     if (_objectReference != null)
     {
         _objectReference.Dispose();
         _objectReference = null;
     }
 }
Beispiel #11
0
 public void Dispose()
 {
     GC.SuppressFinalize(this);
     if (_ObjectReference != null)
     {
         //Now dispose our object reference so our component can be garbage collected
         _ObjectReference.Dispose();
     }
 }
Beispiel #12
0
 void IDisposable.Dispose()
 {
     JsService.RemoveFlatPickrDate(Id);
     if (_objectReference != null)
     {
         _objectReference.Dispose();
         _objectReference = null;
     }
 }
 public void Dispose()
 {
     _disposingCB.Invoke(_elementID);
     lock (this)
     {
         _eventPool.Clear();
     }
     _dotNetObjectReference.Dispose();
 }
 private void ReleaseObjectRef()
 {
     _ObjectRefCounter--;
     if (_ObjectRefCounter == 0)
     {
         _ObjectRef.Dispose();
         _ObjectRef = null;
     }
 }
Beispiel #15
0
        public async ValueTask DisposeAsync()
        {
            if (_moduleTask.IsValueCreated)
            {
                var module = await _moduleTask.Value;
                await module.DisposeAsync();
            }

            _netObjRef.Dispose();
        }
Beispiel #16
0
 public static void DisposeDotNetObjectRef(DotNetObjectReference <ChartAdapter> dotNetObjectReference)
 {
     if (dotNetObjectReference != null)
     {
         lock ( CreateDotNetObjectRefSyncObj )
         {
             dotNetObjectReference.Dispose();
         }
     }
 }
Beispiel #17
0
        public async ValueTask DisposeAsync()
        {
            if (!isDisposed)
            {
                await this.jsRuntime.InvokeVoidAsync("BlazorWorker.disposeWorker", this.Identifier);

                thisReference.Dispose();
                isDisposed = true;
            }
        }
Beispiel #18
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing || _isDisposed)
     {
         return;
     }
     _isDisposed = true;
     Disconnect().AndForget();
     _dotNetRef.Dispose();
 }
 void IDisposable.Dispose()
 {
     JsService.RemoveDocumentEventListener(WvpDomEventType.KeydownEscape, Id);
     JsService.RemoveOutsideClickEventListener($"#{Id}", Id);
     if (_objectReference != null)
     {
         _objectReference.Dispose();
         _objectReference = null;
     }
 }
Beispiel #20
0
        void IDisposable.Dispose()
        {
            new JsService(JSRuntime).RemoveDocumentEventListener(WvpDomEventType.KeydownEscape, Id);

            if (_objectReference != null)
            {
                _objectReference.Dispose();
                _objectReference = null;
            }
        }
 public void DisposeDotNetObjectRef <T>(DotNetObjectReference <T> value) where T : class
 {
     if (value != null)
     {
         lock (CreateDotNetObjectRefSyncObj)
         {
             value.Dispose();
         }
     }
 }
Beispiel #22
0
 /// <summary>
 /// Dispose 方法
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_objRef != null)
         {
             _objRef.Dispose();
             _objRef = null;
         }
     }
 }
        public async ValueTask DisposeAsync()
        {
            await jsRuntime.InvokeVoidAsync("WebRtcHandlerManager.disposeHandler", handlerId);

            virtualStudioConnection.RemoveListener(this);
            foreach (var handler in handlers)
            {
                handler.Dispose();
            }
            objRef.Dispose();
        }
 public void Dispose()
 {
     if (js_interop_reference_to_this == null)
     {
         return;
     }
     if (element.Id != null)
     {
         js.UnobserveResizesAsync(element);
     }
     js_interop_reference_to_this.Dispose();
 }
        public override async ValueTask DisposeAsync()
        {
            if (baseModule != null)
            {
                if (_resizeEventGuid != null)
                {
                    await baseModule.InvokeVoidAsync("deregisterResizeEvent", _resizeEventGuid);
                }

                await baseModule.DisposeAsync();
            }
            selfReference?.Dispose();
        }
Beispiel #26
0
        protected virtual async ValueTask DisposeAsyncCore()
        {
            disposed = true;

            if (jsModule != null)
            {
                await jsModule.InvokeVoidAsync("dispose", toastElement);

                await jsModule.DisposeAsync();
            }

            dotnetObjectReference.Dispose();
        }
Beispiel #27
0
 public void Dispose()
 {
     if (js_interop_reference_to_this == null)
     {
         return;
     }
     if (canvas.Id != null)
     {
         js.UnobserveMovesAsync(canvas);
         js.UnobserveResizesAsync(canvas);
     }
     js_interop_reference_to_this.Dispose();
 }
        public async ValueTask DisposeAsync()
        {
            GC.SuppressFinalize(this);

            if (_ChartJSInstance != null)
            {
                await _ChartJSInstance.InvokeVoidAsync("dispose");

                await _ChartJSInstance.DisposeAsync();
            }

            _Handler?.Dispose();
        }
Beispiel #29
0
        /// <inheritdoc/>
        protected override async ValueTask DisposeAsync(bool disposing)
        {
            if (disposing && Rendered)
            {
                await JSModule.SafeDestroy(ElementRef, ElementId);

                await JSModule.SafeDisposeAsync();

                dotNetObjectRef?.Dispose();
                dotNetObjectRef = null;
            }

            await base.DisposeAsync(disposing);
        }
Beispiel #30
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_isDisposed)
            {
                if (disposing)
                {
                    _runtime.InvokeVoidAsync("howl.destroy");

                    _dotNetObjectReference.Dispose();
                }

                _isDisposed = true;
            }
        }