예제 #1
0
        private void Refresh()
        {
            RefreshOptions refreshOptions = new RefreshOptions();

            refreshOptions.Refresh = true;
            Chameleon.Refresh(refreshOptions);
        }
예제 #2
0
        private async void Signin()
        {
            ErrorMessage = "";
            try {
                var(result, message) = await m_AnilibriaApiService.Authentification(Email, Password, TwoFACode);

                if (result)
                {
                    ChangePage("Releases", null);
                    RefreshOptions?.Invoke();
                    await ChangeUserSession();

                    if (m_AnilibriaApiService.IsAuthorized())
                    {
                        ObserverEvents.FireEvent(
                            "showMessage",
                            new MessageModel {
                            Header  = "Авторизация",
                            Message = "Вы успешно вошли в аккаунт"
                        }
                            );
                    }
                }
                else
                {
                    ErrorMessage = message;
                }
            } catch {
                ErrorMessage = "Ошибка авторизации";
            }
        }
예제 #3
0
            public void Refresh(IBehaviorContext context, RefreshOptions options)
            {
                IViewModel vm = GetValue(context);

                vm.Kernel.Refresh(options.ExecuteRefreshDependencies);
                this.RefreshNext(context, options);
            }
예제 #4
0
 public void Refresh(RefreshOptions options)
 {
     if ((options & RefreshOptions.UpmSearchOffline) != 0)
     {
         UpmClient.instance.SearchAll(true);
     }
     if ((options & RefreshOptions.UpmSearch) != 0)
     {
         UpmClient.instance.SearchAll();
     }
     if ((options & RefreshOptions.UpmListOffline) != 0)
     {
         UpmClient.instance.List(true);
     }
     if ((options & RefreshOptions.UpmList) != 0)
     {
         UpmClient.instance.List();
     }
     if ((options & RefreshOptions.Purchased) != 0)
     {
         AssetStore.AssetStoreClient.instance.List(0, k_DefaultPageSize, string.Empty);
     }
     if ((options & RefreshOptions.PurchasedOffline) != 0)
     {
         AssetStore.AssetStoreClient.instance.RefreshLocal();
     }
 }
예제 #5
0
        public void DoInvoke_ReturnsExpected()
        {
            var opts        = new RefreshOptions();
            var appsettings = new Dictionary <string, string>()
            {
                ["management:endpoints:enabled"]            = "false",
                ["management:endpoints:sensitive"]          = "false",
                ["management:endpoints:path"]               = "/cloudfoundryapplication",
                ["management:endpoints:loggers:enabled"]    = "false",
                ["management:endpoints:loggers:sensitive"]  = "true",
                ["management:endpoints:heapdump:enabled"]   = "true",
                ["management:endpoints:heapdump:sensitive"] = "true",
                ["management:endpoints:cloudfoundry:validatecertificates"] = "true",
                ["management:endpoints:cloudfoundry:enabled"] = "true"
            };
            ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddInMemoryCollection(appsettings);
            var config = configurationBuilder.Build();

            var ep     = new RefreshEndpoint(opts, config);
            var result = ep.DoInvoke(config);

            Assert.NotNull(result);

            Assert.Contains("management:endpoints:loggers:enabled", result);
            Assert.Contains("management:endpoints:heapdump:sensitive", result);
            Assert.Contains("management:endpoints:cloudfoundry:enabled", result);
        }
        private void DoRefreshData(RefreshOptions option)
        {
            int lastPosition = stockSource.Position;

            if (stockSource.DataSource == null)
            {
                stockSource.DataSource = this.myStockTbl;
            }
            if (((byte)option & (byte)RefreshOptions.CodeGroup) > 0)
            {
                int saveGroupIndex = codeGroupCb.SelectedIndex;
                codeGroupCb.LoadData();
                if (saveGroupIndex >= 0 && saveGroupIndex < codeGroupCb.Items.Count)
                {
                    codeGroupCb.SelectedIndex = saveGroupIndex;
                }
                DoFilter(true);
            }
            if (lastPosition >= 0)
            {
                stockSource.Position = lastPosition;
            }

            if (((byte)option & (byte)RefreshOptions.PriceData) > 0)
            {
                DoRefreshPrice(this.myStockTbl);
            }
        }
예제 #7
0
 public virtual void CancelRefresh(RefreshOptions options)
 {
     if ((options & RefreshOptions.Purchased) != 0)
     {
         m_AssetStoreClient.CancelListPurchases();
     }
 }
예제 #8
0
 public void Refresh(RefreshOptions options)
 {
     // make sure the events are registered before actually calling the actual refresh functions
     // such that we don't lose any callbacks events
     RegisterEvents();
     if ((options & RefreshOptions.UpmSearchOffline) != 0)
     {
         UpmClient.instance.SearchAll(true);
     }
     if ((options & RefreshOptions.UpmSearch) != 0)
     {
         UpmClient.instance.SearchAll();
     }
     if ((options & RefreshOptions.UpmListOffline) != 0)
     {
         UpmClient.instance.List(true);
     }
     if ((options & RefreshOptions.UpmList) != 0)
     {
         UpmClient.instance.List();
     }
     if ((options & RefreshOptions.Purchased) != 0)
     {
         AssetStore.AssetStoreClient.instance.List(0, k_DefaultPageSize, string.Empty);
     }
     if ((options & RefreshOptions.PurchasedOffline) != 0)
     {
         AssetStore.AssetStoreClient.instance.RefreshLocal();
     }
 }
예제 #9
0
            public void Refresh(RefreshOptions options)
            {
                if ((options & RefreshOptions.CurrentFilter) != 0)
                {
                    options |= GetRefreshOptionsFromFilterTab(PackageFiltering.instance.currentFilterTab);
                }

                if ((options & RefreshOptions.UpmSearchOffline) != 0)
                {
                    UpmClient.instance.SearchAll(true);
                }
                if ((options & RefreshOptions.UpmSearch) != 0)
                {
                    UpmClient.instance.SearchAll();
                }
                if ((options & RefreshOptions.UpmListOffline) != 0)
                {
                    UpmClient.instance.List(true);
                }
                if ((options & RefreshOptions.UpmList) != 0)
                {
                    UpmClient.instance.List();
                }
                if ((options & RefreshOptions.Purchased) != 0)
                {
                    AssetStore.AssetStoreClient.instance.List(0, k_DefaultPageSize, string.Empty);
                }
                if ((options & RefreshOptions.PurchasedOffline) != 0)
                {
                    AssetStore.AssetStoreClient.instance.Refresh(PackageDatabase.instance.assetStorePackages);
                }
            }
 public void Refresh(IBehaviorContext context, RefreshOptions options)
 {
     if (this.IsLoadedNext(context))
     {
         this.RefreshNext(context, options);
     }
 }
 public void Refresh(
     IBehaviorContext context,
     IVMPropertyDescriptor property,
     RefreshOptions options
     )
 {
     this.ViewModelRefreshNext(context, property, options);
 }
        public void Refresh(IBehaviorContext context, RefreshOptions options)
        {
            var collection = GetValue(context);

            Repopulate(context, collection, RefreshReason.Create(options.ExecuteRefreshDependencies));

            this.RefreshNext(context, options);
        }
        public void Constructor_InitializesWithDefaults()
        {
            var opts = new RefreshOptions();

            Assert.True(opts.Enabled);
            Assert.True(opts.Sensitive);
            Assert.Equal("refresh", opts.Id);
            Assert.Equal(Permissions.RESTRICTED, opts.RequiredPermissions);
        }
예제 #14
0
        public void Constructor_ThrowsIfNulls()
        {
            IRefreshOptions    options       = null;
            IConfigurationRoot configuration = null;

            Assert.Throws <ArgumentNullException>(() => new RefreshEndpoint(options, configuration));

            options = new RefreshOptions();
            Assert.Throws <ArgumentNullException>(() => new RefreshEndpoint(options, configuration));
        }
예제 #15
0
        public void Refresh(IBehaviorContext context, RefreshOptions options)
        {
            TValue childVM = GetValue(context);

            if (childVM != null)
            {
                childVM.Kernel.RefreshWithoutValidation(options.ExecuteRefreshDependencies);
            }

            this.RefreshNext(context, options);
        }
예제 #16
0
            public void Refresh(RefreshOptions options, int pageSize = k_DefaultPageSize)
            {
                if (pageSize == 0)
                {
                    return;
                }

                // make sure the events are registered before actually calling the actual refresh functions
                // such that we don't lose any callbacks events
                UnregisterEvents();
                RegisterEvents();

                if ((options & RefreshOptions.UpmSearchOffline) != 0)
                {
                    UpmClient.instance.SearchAll(true);
                }
                if ((options & RefreshOptions.UpmSearch) != 0)
                {
                    UpmClient.instance.SearchAll();
                }
                if ((options & RefreshOptions.UpmListOffline) != 0)
                {
                    UpmClient.instance.List(true);
                }
                if ((options & RefreshOptions.UpmList) != 0)
                {
                    UpmClient.instance.List();
                }
                if ((options & RefreshOptions.Purchased) != 0)
                {
                    var queryArgs = new PurchasesQueryArgs
                    {
                        startIndex = 0,
                        limit      = pageSize,
                        searchText = string.Empty
                    };

                    IPage page;
                    if (m_Pages.TryGetValue(PackageFilterTab.AssetStore, out page))
                    {
                        queryArgs.statuses       = page.filters.statuses;
                        queryArgs.categories     = page.filters.categories;
                        queryArgs.labels         = page.filters.labels;
                        queryArgs.orderBy        = page.filters.orderBy;
                        queryArgs.isReverseOrder = page.filters.isReverseOrder;
                    }

                    AssetStoreClient.instance.ListPurchases(queryArgs, false);
                }
                if ((options & RefreshOptions.PurchasedOffline) != 0)
                {
                    AssetStoreClient.instance.RefreshLocal();
                }
            }
        public void Refresh(IBehaviorContext context, RefreshOptions options)
        {
            this.RefreshNext(context, options);

            TItemVM selectedItem = this.GetValueNext <TItemVM>(context);

            if (selectedItem != null)
            {
                selectedItem.Kernel.Refresh();
            }
        }
        public void Refresh(IBehaviorContext context, RefreshOptions options)
        {
            this.RefreshNext(context, options);

            IVMCollection <TItemVM> selectedItems = this.GetValueNext <IVMCollection <TItemVM> >(context);

            foreach (TItemVM item in selectedItems)
            {
                item.Kernel.Refresh();
            }
        }
예제 #19
0
        public void Refresh(IBehaviorContext context, RefreshOptions options)
        {
            context.NotifyChange(
                ChangeArgs.PropertyChanged(
                    _property,
                    ValueStage.ValidatedValue,
                    RefreshReason.Create(options.ExecuteRefreshDependencies)
                    )
                );

            this.RefreshNext(context, options);
        }
예제 #20
0
 public virtual UIError GetRefreshError(RefreshOptions option)
 {
     // only return the first one when there are multiple errors
     foreach (var item in m_RefreshErrors)
     {
         if ((option & item.Key) != 0)
         {
             return(item.Value);
         }
     }
     return(null);
 }
예제 #21
0
            public void Refresh(RefreshOptions options)
            {
                var offlineMode = (options & RefreshOptions.OfflineMode) != 0;

                if ((options & RefreshOptions.ListInstalled) != 0)
                {
                    UpmClient.instance.List(offlineMode);
                }
                if ((options & RefreshOptions.SearchAll) != 0)
                {
                    UpmClient.instance.SearchAll(offlineMode);
                }
            }
예제 #22
0
        public static void RefreshNext(
            this Behavior behavior,
            IBehaviorContext context,
            RefreshOptions options
            )
        {
            IRefreshBehavior next;

            if (behavior.TryGetBehavior(out next))
            {
                next.Refresh(context, options);
            }
        }
예제 #23
0
            public void Refresh(RefreshOptions options)
            {
                if ((options & RefreshOptions.CurrentFilter) != 0)
                {
                    switch (PackageFiltering.instance.currentFilterTab)
                    {
                    case PackageFilterTab.All:
                        options |= RefreshOptions.UpmList;
                        options |= RefreshOptions.UpmSearch;
                        break;

                    case PackageFilterTab.Local:
                        options |= RefreshOptions.UpmList;
                        break;

                    case PackageFilterTab.Modules:
                        options |= RefreshOptions.UpmSearchOffline;
                        options |= RefreshOptions.UpmListOffline;
                        break;

                    case PackageFilterTab.AssetStore:
                        options |= RefreshOptions.Purchased;
                        break;

                    case PackageFilterTab.InDevelopment:
                        options |= RefreshOptions.UpmList;
                        break;
                    }
                }

                if ((options & RefreshOptions.UpmSearchOffline) != 0)
                {
                    UpmClient.instance.SearchAll(true);
                }
                if ((options & RefreshOptions.UpmSearch) != 0)
                {
                    UpmClient.instance.SearchAll();
                }
                if ((options & RefreshOptions.UpmListOffline) != 0)
                {
                    UpmClient.instance.List(true);
                }
                if ((options & RefreshOptions.UpmList) != 0)
                {
                    UpmClient.instance.List();
                }
                if (ApplicationUtil.instance.isUserLoggedIn && (options & RefreshOptions.Purchased) != 0)
                {
                    AssetStore.AssetStoreClient.instance.List(0, k_DefaultPageSize, string.Empty);
                }
            }
예제 #24
0
        // TODO: What about naming conflicts between VM Behaviors and Property behaviors?
        public static void ViewModelRefreshNext(
            this Behavior behavior,
            IBehaviorContext context,
            IVMPropertyDescriptor property,
            RefreshOptions options
            )
        {
            IRefreshControllerBehavior next;

            if (behavior.TryGetBehavior(out next))
            {
                next.Refresh(context, property, options);
            }
        }
예제 #25
0
        public void RefreshEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var opts = new RefreshOptions();
            ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddInMemoryCollection(OwinTestHelpers.Appsettings);
            var config = configurationBuilder.Build();
            var ep     = new RefreshEndpoint(opts, config);
            var middle = new EndpointOwinMiddleware <IList <string> >(null, ep);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/refresh"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/refresh"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/badpath"));
        }
예제 #26
0
        public virtual void Refresh(RefreshOptions options, int pageSize = k_DefaultPageSize)
        {
            if (pageSize == 0)
            {
                return;
            }

            if ((options & RefreshOptions.UpmSearchOffline) != 0)
            {
                m_UpmClient.SearchAll(true);
            }
            if ((options & RefreshOptions.UpmSearch) != 0)
            {
                m_UpmClient.SearchAll();
            }
            if ((options & RefreshOptions.UpmListOffline) != 0)
            {
                m_UpmClient.List(true);
            }
            if ((options & RefreshOptions.UpmList) != 0)
            {
                m_UpmClient.List();
            }
            if ((options & RefreshOptions.Purchased) != 0)
            {
                var queryArgs = new PurchasesQueryArgs
                {
                    startIndex = 0,
                    limit      = pageSize,
                    searchText = string.Empty
                };

                IPage page;
                if (m_Pages.TryGetValue(PackageFilterTab.AssetStore, out page))
                {
                    queryArgs.statuses       = page.filters.statuses;
                    queryArgs.categories     = page.filters.categories;
                    queryArgs.labels         = page.filters.labels;
                    queryArgs.orderBy        = page.filters.orderBy;
                    queryArgs.isReverseOrder = page.filters.isReverseOrder;
                }

                m_AssetStoreClient.ListPurchases(queryArgs, false);
            }
            if ((options & RefreshOptions.PurchasedOffline) != 0)
            {
                m_AssetStoreClient.RefreshLocal();
            }
        }
예제 #27
0
 public virtual bool IsInitialFetchingDone(RefreshOptions option)
 {
     foreach (var item in m_RefreshTimestamps)
     {
         if ((option & item.Key) == 0)
         {
             continue;
         }
         if (item.Value == 0)
         {
             return(false);
         }
     }
     return(true);
 }
예제 #28
0
            public void Refresh(RefreshOptions options)
            {
                onRefreshOperationError?.Invoke(null);

                var offlineMode = (options & RefreshOptions.OfflineMode) != 0;

                if ((options & RefreshOptions.ListInstalled) != 0)
                {
                    UpmClient.instance.List(offlineMode);
                }
                if ((options & RefreshOptions.SearchAll) != 0)
                {
                    UpmClient.instance.SearchAll(offlineMode);
                }
                if (ApplicationUtil.instance.isUserLoggedIn && (options & RefreshOptions.Purchased) != 0)
                {
                    AssetStore.AssetStoreClient.instance.List(0, 1000);
                }
            }
예제 #29
0
            public void Refresh(RefreshOptions options, int pageSize = 25)
            {
                if (pageSize == 0)
                {
                    return;
                }

                // make sure the events are registered before actually calling the actual refresh functions
                // such that we don't lose any callbacks events
                RegisterEvents();
                if ((options & RefreshOptions.UpmSearchOffline) != 0)
                {
                    UpmClient.instance.SearchAll(true);
                }
                if ((options & RefreshOptions.UpmSearch) != 0)
                {
                    UpmClient.instance.SearchAll();
                }
                if ((options & RefreshOptions.UpmListOffline) != 0)
                {
                    UpmClient.instance.List(true);
                }
                if ((options & RefreshOptions.UpmList) != 0)
                {
                    UpmClient.instance.List();
                }
                if ((options & RefreshOptions.Purchased) != 0)
                {
                    var queryArgs = new PurchasesQueryArgs
                    {
                        startIndex = 0,
                        limit      = pageSize,
                        searchText = string.Empty
                    };
                    AssetStoreClient.instance.ListPurchases(queryArgs, false);
                }
                if ((options & RefreshOptions.PurchasedOffline) != 0)
                {
                    AssetStoreClient.instance.RefreshLocal();
                }
            }
예제 #30
0
        static async Task <int> RunTokenRefresh(RefreshOptions args)
        {
            Console.WriteLine(":: Token refresh ::");
            try
            {
                Console.WriteLine("Loading tokens from file...");
                var authService = await AuthenticationService.LoadFromJsonFileAsync(args.TokenFilepath);

                Console.WriteLine("Refreshing tokens...");
                await authService.AuthenticateAsync();

                Console.WriteLine("Saving refreshed tokens to file...");
                await authService.DumpToJsonFileAsync(args.TokenFilepath);
            }
            catch (Exception exc)
            {
                Console.WriteLine($"Failed to refresh tokens, error: {exc}");
                return(1);
            }
            return(0);
        }
        private void DoRefreshData(RefreshOptions option)
        {
            int lastPosition = stockSource.Position;
            if (stockSource.DataSource == null)
                stockSource.DataSource = this.myStockTbl;
            if (((byte)option & (byte)RefreshOptions.CodeGroup) > 0)
            {
                int saveGroupIndex = codeGroupCb.SelectedIndex;
                codeGroupCb.LoadData();
                if (saveGroupIndex >= 0 && saveGroupIndex < codeGroupCb.Items.Count)
                    codeGroupCb.SelectedIndex = saveGroupIndex;
                DoFilter(true);
            }
            if (lastPosition >= 0) stockSource.Position = lastPosition;

            if (((byte)option & (byte)RefreshOptions.PriceData) > 0) DoRefreshPrice(this.myStockTbl);
        }