private string GetFileSizeDisplayText(LoadingStatus status)
        {
            switch (status)
            {
                case LoadingStatus.NotStarted:
                    return "";

                case LoadingStatus.Verifying:
                    return "Haetaan...";

                case LoadingStatus.Verified:
                case LoadingStatus.Loading:
                case LoadingStatus.Success:
                case LoadingStatus.Error:

                    if (Model.Operation == MapPackageOperation.OperationType.Removal)
                        return "(poisto)";

                    return FileSizeUtil.Humanize(Model.ActualSize);

                case LoadingStatus.Failure:
                    return "Epäonnistui!";

                default:
                    throw new ArgumentOutOfRangeException("status");
            }
        }
    public static void LoadAssets()
    {
        PlayerHolder.Initialize();
        EnemyHolder.Initialize();
        WeaponHolder.Initialize();
        AmmunitionDropHolder.Initialize();
        ProjectileHolder.Initialize();
        SoundHolder.Initialize();
        VisualEffectHolder.Initialize();
        AnimationHolder.Initialize();
        MapHolder.Initialize();

        OnLoadingStatus += PlayerHolder.CurrentLoadingPercentage;
        OnLoadingStatus += EnemyHolder.CurrentLoadingPercentage;
        OnLoadingStatus += WeaponHolder.CurrentLoadingPercentage;
        OnLoadingStatus += ProjectileHolder.CurrentLoadingPercentage;
        OnLoadingStatus += SoundHolder.CurrentLoadingPercentage;
        OnLoadingStatus += VisualEffectHolder.CurrentLoadingPercentage;
        OnLoadingStatus += AnimationHolder.CurrentLoadingPercentage;
        OnLoadingStatus += AmmunitionDropHolder.CurrentLoadingPercentage;
        OnLoadingStatus += MapHolder.CurrentLoadingPercentage;

        PlayerHolder.LoadAssets();
        EnemyHolder.LoadAssets();
        WeaponHolder.LoadAssets();
        ProjectileHolder.LoadAssets();
        SoundHolder.LoadAssets();
        VisualEffectHolder.LoadAssets();
        AnimationHolder.LoadAssets();
        AmmunitionDropHolder.LoadAssets();
        MapHolder.LoadAssets();
    }
Ejemplo n.º 3
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            AccountInfo.Password = PasswordInput.Password;
            IsLoginRequesting    = true;

            Task.Run(() =>
            {
                using (LoadingStatus.BeginBusy("正在登录..."))
                {
                    try
                    {
                        var feature = Gallery.Feature <IGalleryAccount>();

                        feature.AccountLogin(AccountInfo);

                        if (feature.IsLoggined)
                        {
                            Toast.ShowMessage($"登录成功");

                            Dispatcher.Invoke(() => NavigationHelper.NavigationPop());
                        }
                    }
                    catch (Exception e)
                    {
                        Toast.ShowMessage($"登录失败!原因:{e.Message}");
                    }
                    Dispatcher.Invoke(() => IsLoginRequesting = false);
                }
            });
        }
Ejemplo n.º 4
0
        private async Task DisplayImage(DownloadableImageLink pick_download)
        {
            DetailImageBox.ImageSource = null;
            RefreshButton.IsBusy       = true;
            const string notify_content = "加载图片中......";

            using var notify = LoadingStatus.BeginBusy(notify_content);

            var downloader = Container.Default.GetExportedValue <ImageFetchDownloadScheduler>();

            var image = await ImageResourceManager.RequestImageFromNetworkAsync(pick_download.FullFileName, pick_download.DownloadLink, true, d =>
            {
                var(cur, total)    = d;
                notify.Description = $"({cur * 1.0 / total * 100:F2}%) {notify_content}";
            });

            if (image is null)
            {
                Toast.ShowMessage("加载图片失败");
            }

            CurrentDisplayImageLink = image is null ? null : pick_download;

            DetailImageBox.ImageSource = image?.ConvertToBitmapImage();

            RefreshButton.IsBusy = false;
        }
Ejemplo n.º 5
0
 public static void removeLoadingStatus(LoadingStatus status)
 {
     Application.Current.Dispatcher.InvokeAsync(() => {
         _loadingMessages.Remove(getMessage(status));
         CreateLoadingMessage();
     }, DispatcherPriority.ContextIdle);
 }
Ejemplo n.º 6
0
        private static PackageSearchStatus Convert(LoadingStatus status)
        {
            switch (status)
            {
            case LoadingStatus.Cancelled:
                return(PackageSearchStatus.Cancelled);

            case LoadingStatus.ErrorOccurred:
                return(PackageSearchStatus.ErrorOccurred);

            case LoadingStatus.Loading:
                return(PackageSearchStatus.Loading);

            case LoadingStatus.NoItemsFound:
                return(PackageSearchStatus.NoPackagesFound);

            case LoadingStatus.NoMoreItems:
            case LoadingStatus.Ready:
                return(PackageSearchStatus.PackagesFound);

            case LoadingStatus.Unknown:
            default:
                return(PackageSearchStatus.Unknown);
            }
        }
Ejemplo n.º 7
0
 public ContentItem(string uri, IDisposable content)
 {
     URI           = uri;
     Content       = content;
     LoadingStatus = LoadingStatus.NotLoaded;
     _disposed     = false;
 }
Ejemplo n.º 8
0
            /// <summary>
            /// Convert.
            /// </summary>
            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            {
                LoadingStatus status = (LoadingStatus)value;

                switch (status)
                {
                case LoadingStatus.START:
                    return(startBrush);

                case LoadingStatus.LOADING:
                    return(loadingBrush);

                case LoadingStatus.ABORTED:
                    return(abortBrush);

                case LoadingStatus.REQUEST_FAILURE:
                    return(failureBrush);

                case LoadingStatus.DONE:
                    return(doneBrush);

                default:
                    return(Brushes.Black);
                }
            }
Ejemplo n.º 9
0
        internal static async Task <List <T> > Depage(Paging <T> page, LoadingStatus status = null)
        {
            var loadedItems = page.Items;
            var passedPage  = page;

            status?.SetAvailable(page.Total);
            status?.SetLoaded(loadedItems.Count);

            // then iterate over all the next pages
            while (page.HasNextPage())
            {
                page = await API.S.GetNextPageAsync(page);

                loadedItems.AddRange(page.Items);
                status?.SetLoaded(loadedItems.Count);
            }

            // Handle previous pages if supplied page parameter was not the first page
            while (passedPage.HasPreviousPage())
            {
                passedPage = await API.S.GetPreviousPageAsync(passedPage);

                loadedItems.AddRange(passedPage.Items);
                status?.SetLoaded(loadedItems.Count);
            }

            return(loadedItems);
        }
Ejemplo n.º 10
0
        public override async Task <SearchResult <IPackageSearchMetadata> > ContinueSearchAsync(ContinuationToken continuationToken, CancellationToken cancellationToken)
        {
            var searchToken = continuationToken as FeedSearchContinuationToken;

            if (searchToken == null)
            {
                throw new InvalidOperationException("Invalid token");
            }

            IEnumerable <IPackageSearchMetadata> packagesWithUpdates = await GetPackagesWithUpdatesAsync(searchToken.SearchString, searchToken.SearchFilter, cancellationToken);

            IPackageSearchMetadata[] items = packagesWithUpdates
                                             .Skip(searchToken.StartIndex)
                                             .ToArray();

            SearchResult <IPackageSearchMetadata> result = SearchResult.FromItems(items);

            LoadingStatus loadingStatus = items.Length == 0
                ? LoadingStatus.NoItemsFound
                : LoadingStatus.NoMoreItems;

            result.SourceSearchStatus = new Dictionary <string, LoadingStatus>
            {
                ["Update"] = loadingStatus
            };

            return(result);
        }
Ejemplo n.º 11
0
        public int loading_status; //  0:EMPTY 1:Loaded 2:Abnormal

        public override string ToString()
        {
            LiftStatus    liftstatus = (LiftStatus)moving_status;
            LoadingStatus loadstatus = (LoadingStatus)loading_status;

            return(string.Format("id:{0} MoveState:{1} LoadState:{2}", mid, liftstatus, loadstatus));
        }
        private Label GetStatusView(LoadingStatus status = LoadingStatus.Loading)
        {
            _loadingStatus = status;

            string text = "Loading...";

            if (status == LoadingStatus.Fail)
            {
                text = "Load content fail, tapped be reload.";
            }

            var label = new Label()
            {
                Text              = text,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                FontSize          = 16,
            };

            label.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() => StatusViewTapped()),
            });

            return(label);
        }
Ejemplo n.º 13
0
        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            AccountInfo.Password = PasswordInput.Password;
            IsLoginRequesting    = true;

            var feature = Gallery.Feature <IGalleryAccount>();

            using var status = LoadingStatus.BeginBusy("正在登录...");

            await Task.Run(() =>
            {
                try
                {
                    feature.AccountLogin(AccountInfo);
                }
                catch (Exception e)
                {
                    Toast.ShowMessage($"登录失败!原因:{e.Message}");
                }
            });

            IsLoginRequesting = false;

            if (feature.IsLoggined)
            {
                Toast.ShowMessage($"登录成功");
                NavigationHelper.NavigationPop();

                if (AutoLogin.IsChecked ?? false)
                {
                    var container = SettingManager.LoadSetting <AccountInfoDataContainer>();
                    container.SaveAccountInfoData(Gallery, AccountInfo);
                }
            }
        }
Ejemplo n.º 14
0
        private void ContinueUpdate()
        {
            splashAnimationTimer.Stop();

            if (loadingContext != null)
            {
                loadingContext.IsLoading = true;
                loadingContext.IsWaiting = true;
                loadingStatus            = LoadingStatus.ContinueLoading;

                if (AutoEnd)
                {
                    splashAnimationTimer.Interval = AutoEndTime;
                    splashAnimationTimer.Start();
                }

                var animation = new DoubleAnimation
                {
                    From     = loadControl.Opacity,
                    To       = 1,
                    Duration = StartAnimationTime
                };

                loadControl.BeginAnimation(UIElement.OpacityProperty, animation);
            }
        }
Ejemplo n.º 15
0
 private static void SetNodeTreeStatus(Node node, LoadingStatus status)
 {
     node.Status = status;
     foreach (Node child in node.Children)
     {
         SetNodeTreeStatus(child, status);
     }
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Loading folder.
 /// </summary>
 public void LoadingSubfolderAsync()
 {
     if (status == LoadingStatus.START)
     {
         status = LoadingStatus.LOADING;
         this.worker.RunWorkerAsync();
     }
 }
        public void SetStatus(LoadingStatus status)
        {
            View.SetStatusIndicatorImage(GetStatusIndicatorImage(status));
            View.SetPackageSize(GetFileSizeDisplayText(status));
            View.SetActive(status == LoadingStatus.Loading);
            View.SetTooltip(GetTooltipText(status));

            this._status = status;
        }
 public AsyncLoadSceneOperation(string scenePath, int sceneSize, int expectedSharedComponentCount, string resourcesPath, EntityManager entityManager)
 {
     _ScenePath     = scenePath;
     _SceneSize     = sceneSize;
     _ResourcesPath = resourcesPath;
     _EntityManager = entityManager;
     _LoadingStatus = LoadingStatus.NotStarted;
     _ExpectedSharedComponentCount = expectedSharedComponentCount;
 }
Ejemplo n.º 19
0
 public AsyncLoadSceneOperation(string scenePath, int sceneSize, int expectedObjectReferenceCount, string resourcesPathObjRefs, EntityManager entityManager, bool usingBundles)
 {
     _ScenePath                    = scenePath;
     _SceneSize                    = sceneSize;
     _ResourcesPathObjRefs         = resourcesPathObjRefs;
     _EntityManager                = entityManager;
     _LoadingStatus                = LoadingStatus.NotStarted;
     _ExpectedObjectReferenceCount = expectedObjectReferenceCount;
     _UsingBundles                 = usingBundles;
 }
Ejemplo n.º 20
0
 public void AddLoadingStatus(string status)
 {
     LoadingStatus.Add(status);
     if (!IsLoading)
     {
         Debug.WriteLine("[LoadingService] Loading Start");
         IsLoading     = true;
         CurrentStatus = status;
     }
 }
Ejemplo n.º 21
0
        private void LoadingStatusAdded(object sender, LoadingStatusAddedEventArgs e)
        {
            LoadingStatus newStatus = e.NewStatus;

            newStatus.FinishedEvent         += StatusFinishedEvent;
            newStatus.LoadingProcessChanged += StatusLoadingProcessChanged;
            TextBlock statusTextBlock = new TextBlock( );

            statusTextBlock.FontSize   = XamlResources.Resources.FontSize;
            statusTextBlock.FontFamily = XamlResources.Resources.Font;
        }
Ejemplo n.º 22
0
 public void OnLoad(object sender, LoadingStatus e)
 {
     if (e == LoadingStatus.Completed)
     {
         SetContentCompleted?.Invoke(this, EventArgs.Empty);
     }
     else
     {
         SetContentStarting?.Invoke(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 23
0
 public NSCmisTree(Node root)
 {
     Name = root.Name;
     Status = root.Status;
     Selected = root.Selected;
     Parent = null;
     foreach (Node node in root.Children) {
         NSCmisTree child = new NSCmisTree (node);
         child.Parent = this;
         Children.Add (child);
     }
 }
Ejemplo n.º 24
0
        private static string getMessage(LoadingStatus status)
        {
            switch (status)
            {
            case LoadingStatus.SettingSongMastery: return("Setting song(s) mastery");

            case LoadingStatus.SelectingPlaylist: return("Selecting playlist");

            case LoadingStatus.SortingSongs: return("Sorting songs");

            default: return("");
            }
        }
Ejemplo n.º 25
0
 public SearchPageTelemetryEvent(
     Guid parentId,
     int pageIndex,
     int resultCount,
     TimeSpan duration,
     LoadingStatus loadingStatus) : base("SearchPage")
 {
     base["ParentId"]      = parentId.ToString();
     base["PageIndex"]     = pageIndex;
     base["ResultCount"]   = resultCount;
     base["Duration"]      = duration.TotalSeconds;
     base["LoadingStatus"] = loadingStatus.ToString();
 }
Ejemplo n.º 26
0
 public NSCmisTree(Node root)
 {
     Name     = root.Name;
     Status   = root.Status;
     Selected = root.Selected;
     Parent   = null;
     foreach (Node node in root.Children)
     {
         NSCmisTree child = new NSCmisTree(node);
         child.Parent = this;
         Children.Add(child);
     }
 }
Ejemplo n.º 27
0
        private void ThrowIfNotComplete()
        {
            LoadingStatus status = LoadingStatus;

            if (status == LoadingStatus.Failed)
            {
                throw new Exception("Cannot use a failed ContentFile operation.");
            }
            if (status == LoadingStatus.InProgress)
            {
                throw new Exception("This ContentFile functionality is not supported while loading is in progress");
            }
        }
Ejemplo n.º 28
0
 private void reset()
 {
     target         = fillPercentage + Random.Range(0.2f, 1.5f) * fillAmount;
     fillPercentage = 0f;
     mat.SetFloat("_Fillpercentage", fillPercentage);
     loadingBar_inner.SetActive(true);
     loadingText.SetActive(true);
     mat.SetFloat("_Globalopacity", initialGlobalOpacity);
     scale = initialScale;
     loadingBar.localScale = scale;
     radius = initialRadius;
     mat.SetFloat("_Radius", radius);
     status = LoadingStatus.filling;
 }
Ejemplo n.º 29
0
        private void StatusLoadingProcessChanged(object sender, EventArgs e)
        {
            LoadingStatus status          = ( LoadingStatus )sender;
            TextBlock     statusTextBlock = GetTextBlock(status);

            if (status.LoadingProcess <= 100)
            {
                statusTextBlock.Text = $"{status . Name}…{status . LoadingProcess}";
            }
            else
            {
                statusTextBlock.Text = $"{status . Name}…OK";
            }
        }
Ejemplo n.º 30
0
    private void InitVariables()
    {
        _chunkSize         = (chunkPrefab.blockSize * chunkPrefab.chunkSize) / chunkPrefab.PixelUnitSize;
        worldLoadingStatus = worldLoadingStatus == null?GetComponent <LoadingStatus>() : worldLoadingStatus;

        if (chunkPrefab == null)
        {
            Debug.LogError("Chunk Prefab not specified!");
            Destroy(this);
            return;
        }

        _chunks = new Dictionary <Vector2, Chunk>();
    }
Ejemplo n.º 31
0
 void Start()
 {
     loadingBar_inner.SetActive(true);
     loadingText.SetActive(true);
     mat = loadingBar.GetComponent <Image>().material;
     initialFillpercentage = mat.GetFloat("_Fillpercentage");
     initialGlobalOpacity  = mat.GetFloat("_Globalopacity");
     initialScale          = loadingBar.localScale;
     scale         = initialScale;
     status        = LoadingStatus.filling;
     initialRadius = mat.GetFloat("_Radius");
     radius        = initialRadius;
     mat.SetFloat("_Fillpercentage", fillPercentage);
     target = fillPercentage + Random.Range(0.2f, 1.5f) * fillAmount;
 }
Ejemplo n.º 32
0
            /// <summary>
            /// Convert.
            /// </summary>
            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            {
                LoadingStatus status = (LoadingStatus)value;

                switch (status)
                {
                case LoadingStatus.LOADING:
                    return(Properties_Resources.LoadingStatusLOADING);

                case LoadingStatus.START:
                    return(Properties_Resources.LoadingStatusSTART);

                default:
                    return("");
                }
            }
Ejemplo n.º 33
0
 public SearchPageTelemetryEvent(
     Guid parentId,
     int pageIndex,
     int resultCount,
     TimeSpan duration,
     IEnumerable <TimeSpan> sourceTimings,
     TimeSpan aggregationTime,
     LoadingStatus loadingStatus) : base("SearchPage")
 {
     base["ParentId"]    = parentId.ToString();
     base["PageIndex"]   = pageIndex;
     base["ResultCount"] = resultCount;
     base["Duration"]    = duration.TotalSeconds;
     base["IndividualSourceDurations"]  = TelemetryUtility.ToJsonArrayOfTimingsInSeconds(sourceTimings);
     base["ResultsAggregationDuration"] = aggregationTime.TotalSeconds;
     base["LoadingStatus"] = loadingStatus.ToString();
 }
Ejemplo n.º 34
0
 internal void OnRemove()
 {
     if (_collection == null)
     {
         return;
     }
     lock (_collection)
     {
         LoadingStatus = LoadingStatus.Remove;
     }
 }
Ejemplo n.º 35
0
 /// <summary>
 /// 执行加载数据工厂
 /// </summary>
 /// <param name="loadFactory"></param>
 /// <param name="isReload">是否重新加载</param>
 /// <exception cref="NullReferenceException"></exception>
 internal void OnLoadFactory(Func<bool> loadFactory, bool isReload)
 {
     if (_collection == null)
     {
         TraceLog.WriteError("LoadFactory loaded fail,collection is null");
         return;
     }
     lock (_collection)
     {
         //重新加载或未加载成功时,执行加载数据工厂
         if (isReload || !HasLoadSuccess)
         {
             if (loadFactory != null && loadFactory())
             {
                 LoadingStatus = LoadingStatus.Success;
             }
         }
     }
 }
        private string GetTooltipText(LoadingStatus status)
        {
            switch (status)
            {
                case LoadingStatus.NotStarted:
                    if (Model.Operation == MapPackageOperation.OperationType.LocalInstallation)
                        return "Paikallinen paketti";

                    if (Model.Operation == MapPackageOperation.OperationType.OnlineInstallation)
                        return "Online-paketti";

                    if (Model.Operation == MapPackageOperation.OperationType.Removal)
                        return "Poistettava paketti";

                    throw new ArgumentOutOfRangeException("Model.Operation");

                case LoadingStatus.Verifying:
                    return "Vahvistetaan...";
                case LoadingStatus.Verified:
                    return "Jonossa";
                case LoadingStatus.Loading:
                    return "Ladataan...";
                case LoadingStatus.Success:
                    return "Valmis";
                case LoadingStatus.Error:
                    return "Virhe. Yritetään hetken kuluttua uudestaan.";
                case LoadingStatus.Failure:
                    return "Paketin lataus epäonnistui.";
                default:
                    throw new ArgumentOutOfRangeException("status");
            }
        }
Ejemplo n.º 37
0
 private static void SetNodeTreeStatus(Node node, LoadingStatus status)
 {
     node.Status = status;
     foreach (Node child in node.Children)
     {
         SetNodeTreeStatus(child, status);
     }
 }
        private Image GetStatusIndicatorImage(LoadingStatus status)
        {
            switch (status)
            {
                case LoadingStatus.NotStarted:
                case LoadingStatus.Verified:

                    if (Model.Operation == MapPackageOperation.OperationType.LocalInstallation)
                        return Properties.Resources.status_notstarted_local;

                    if (Model.Operation == MapPackageOperation.OperationType.OnlineInstallation)
                        return Properties.Resources.status_notstarted_web;

                    if (Model.Operation == MapPackageOperation.OperationType.Removal)
                        return Properties.Resources.status_delete;

                    throw new ArgumentOutOfRangeException("Model.Operation");

                case LoadingStatus.Verifying:
                    return Properties.Resources.status_loading_transparent;
                case LoadingStatus.Loading:
                    return Properties.Resources.status_loading_transparent;
                case LoadingStatus.Success:
                    return Properties.Resources.status_success;
                case LoadingStatus.Error:
                    return Properties.Resources.status_fail;
                case LoadingStatus.Failure:
                    return Properties.Resources.status_fail;
                default:
                    throw new ArgumentOutOfRangeException("status");
            }
        }