Ejemplo n.º 1
0
        /// <summary>
        /// Start ad-hoc scan
        /// </summary>
        /// <param name="discoverer"></param>
        private async Task SetAdHocScanAsync(DiscovererInfo discoverer)
        {
            if (!IsDiscoveryEventSubscribed)
            {
                discoverer.DiscoveryRequestId = Guid.NewGuid().ToString();
                Discovery = await RegistryServiceEvents.SubscribeDiscoveryProgressByRequestIdAsync(
                    discoverer.DiscoveryRequestId, async data => {
                    await InvokeAsync(() => ScanProgress(data));
                });

                IsDiscoveryEventSubscribed = true;
            }

            try {
                EventResult = string.Empty;

                discoverer.IsSearching = true;
                ScanResult             = "displayBlock";
                DiscovererData         = discoverer;
                Status = await RegistryHelper.DiscoverServersAsync(discoverer);
            }
            catch {
                if (Discovery != null)
                {
                    await Discovery.DisposeAsync();
                }
                IsDiscoveryEventSubscribed = false;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// ClickHandler
 /// </summary>
 async Task ClickHandlerAsync(DiscovererInfo discoverer)
 {
     CloseDrawer();
     if (discoverer.isAdHocDiscovery)
     {
         await SetAdHocScanAsync(discoverer);
     }
     else
     {
         await OnAfterRenderAsync(true);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Enable discoverer scan
        /// </summary>
        /// <param name="discoverer"></param>
        private async Task SetScanAsync(DiscovererInfo discoverer, bool checkStatus)
        {
            try {
                discoverer.ScanStatus = checkStatus;
                EventResult           = string.Empty;

                if (discoverer.ScanStatus == true)
                {
                    if (!IsDiscoveryEventSubscribed)
                    {
                        Discovery = await RegistryServiceEvents.SubscribeDiscoveryProgressByDiscovererIdAsync(
                            discoverer.DiscovererModel.Id, async data => {
                            await InvokeAsync(() => ScanProgress(data));
                        });
                    }

                    IsDiscoveryEventSubscribed = true;
                    discoverer.IsSearching     = true;
                    ScanResult     = "displayBlock";
                    DiscovererData = discoverer;
                }
                else
                {
                    discoverer.IsSearching = false;
                    ScanResult             = "displayNone";
                    if (Discovery != null)
                    {
                        await Discovery.DisposeAsync();
                    }
                    IsDiscoveryEventSubscribed = false;
                }
                Status = await RegistryHelper.SetDiscoveryAsync(discoverer);
            }
            catch {
                if (Discovery != null)
                {
                    await Discovery.DisposeAsync();
                }
                IsDiscoveryEventSubscribed = false;
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Open then Drawer
 /// </summary>
 /// <param name="OpenDrawer"></param>
 private void OpenDrawer(DiscovererInfo discoverer)
 {
     IsOpen         = true;
     DiscovererData = discoverer;
 }