Exemple #1
0
        private bool MatchWithSearchQuery(AppInfoForInstall app, string searchQuery)
        {
            var keywords = searchQuery.Split(' ');

            var description   = app.AppInfo.Description;
            var appName       = app.AppInfo.Name;
            var developerName = app.AppInfo.DeveloperName;

            var searchTargets = new string[] { description, appName, developerName };

            foreach (var keyword in keywords)
            {
                var keywordFound = false;
                foreach (var target in searchTargets)
                {
                    if (target.ToLower().Contains(keyword.ToLower()))
                    {
                        keywordFound = true;
                        break;
                    }
                }

                if (!keywordFound)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #2
0
        private bool IsAppDisplayed(AppInfoForInstall app, string searchQuery)
        {
            if (app.AppInfo.Versions.Count == 0)
            {
                return(false);
            }

            var architectureIsValid  = true;
            var supportedArchtecture = app.AppInfo.SupportedArchitecture;

            if (TargetIsHoloLens1)
            {
                architectureIsValid = supportedArchtecture.HasFlag(SupportedArchitectureType.X86);
            }
            else if (TargetIsHoloLens2)
            {
                architectureIsValid = supportedArchtecture.HasFlag(SupportedArchitectureType.Arm) ||
                                      supportedArchtecture.HasFlag(SupportedArchitectureType.Arm64);
            }

            return(architectureIsValid && MatchWithSearchQuery(app, searchQuery));
        }
Exemple #3
0
 public EditApplicationViewModel()
 {
     uploader          = new AzureStorageUploader();
     AppInfoForInstall = new AppInfoForInstall();
 }
Exemple #4
0
        private async Task UploadPackage()
        {
            Uploading      = true;
            SuccessMessage = "";
            ErrorMessage   = "";

            // アップロードするパッケージをクラスに格納
            var version = new AppVersion()
            {
                Version1 = StringToUint(version1),
                Version2 = StringToUint(version2),
                Version3 = StringToUint(version3),
                Version4 = StringToUint(version4),
            };

            var supportedArchitecture = SupportedArchitectureHelper.GetSupportedArchitectureFromAppPackage(appPackage);

            // アプリが対応するアーキテクチャ依存ファイルのみをアップロード
            var dependencies = new List <StorageFile>();

            foreach (var dep in dependenciesFiles)
            {
                var parent          = System.IO.Directory.GetParent(dep.Path);
                var depArchitecture = SupportedArchitectureHelper.StringToSupportedArchitectureType(parent.Name);

                if (supportedArchitecture.HasFlag(depArchitecture))
                {
                    dependencies.Add(dep);
                }
            }

            var uploadPackage = new Application()
            {
                DeveloperName         = developerName,
                Name                  = name,
                Version               = version,
                SupportedArchitecture = supportedArchitecture,
                AppPackage            = appPackage,
                Dependencies          = dependencies,
            };

            var r = ResourceLoader.GetForCurrentView();

            if (uploadPackage.IsValid)
            {
                var uploadingMessageTemplate = r.GetString("Upload_UploadingMessage");
                var uploadingMessage         = string.Format(uploadingMessageTemplate, uploadPackage.Name);

                var uploadedMessageTemplate = r.GetString("Upload_SuccessMessage");
                var uploadedMessage         = string.Format(uploadedMessageTemplate, uploadPackage.Name + " " + uploadPackage.Version.ToString());

                indicator?.Hide();
                indicator = new BusyIndicator()
                {
                    Message = uploadingMessage
                };
                indicator.Show();

                SuccessMessage = uploadingMessage;

                var(appInfo, result) = await uploader.Upload(uploadPackage);

                switch (result)
                {
                case UploadStatusType.NewlyUploaded:
                    var app = new AppInfoForInstall()
                    {
                        AppInfo = appInfo
                    };
                    app.SelectLatestVersion();
                    NavigationService.Navigate(typeof(EditApplicationPage), app);
                    break;

                case UploadStatusType.Updated:
                    // 入力項目をクリア
                    Version1   = "";
                    Version2   = "";
                    Version3   = "";
                    Version4   = "";
                    Name       = "";
                    AppPackage = null;
                    await ClearDependency();

                    SuccessMessage = uploadedMessage;
                    break;

                case UploadStatusType.NetworkError:
                case UploadStatusType.UnknownError:
                    SuccessMessage = "";
                    ErrorMessage   = r.GetString("Upload_FailureMessage");
                    break;
                }
                indicator?.Hide();
            }
            else
            {
                ErrorMessage = r.GetString("Upload_MissingMessage");
            }
            Uploading = false;
        }