예제 #1
0
        void SetPageState(PredictionPageState state)
        {
            pageState = state;

            switch (pageState)
            {
            case PredictionPageState.CameraReady:
            {
                HeroImage = null;
            }
            break;

            case PredictionPageState.NoCameraReady:
            {
                HeroImage    = ImageSource.FromFile("CameraMissing");
                TitleLabel   = ApplicationResource.CameraNotSupportedTitle;
                MessageLabel = ApplicationResource.CameraNotSupportedMessage;
            }
            break;

            case PredictionPageState.NoModelAvailable:
            {
                HeroImage    = ImageSource.FromFile("CloudMissing");
                TitleLabel   = ApplicationResource.PredictionModelUnavailableTitle;
                MessageLabel = ApplicationResource.PredictionModelUnavailableMessage;
            }
            break;

            case PredictionPageState.Uploading:
            {
                HeroImage    = ImageSource.FromFile("CameraUpload");
                TitleLabel   = ApplicationResource.PagePredictionInputUploadingTitle;
                MessageLabel = ApplicationResource.PagePredictionInputUploadingMessage;
            }
            break;

            default:
                break;
            }

            var eventData = new PageStateEventArgs(pageState);

            UpdatePageState?.Invoke(this, eventData);
        }
예제 #2
0
        public PredictionInputViewModel(INavigation navigation)
        {
            this.Navigation = navigation;
            database        = ServiceContainer.Resolve <IDatabase>();

            RefreshViewCommand = new Command(async() =>
            {
                var hasActiveModel = await AzureService.RemoteModelAvailable();
                var hasModelName   = !string.IsNullOrEmpty(Settings.PublishedModelName);
                bool isAvilable    = (hasActiveModel || hasModelName);

                PredictionPageState state = isAvilable ?
                                            (CrossMedia.Current.IsCameraAvailable ? PredictionPageState.CameraReady : PredictionPageState.NoCameraReady)
                                        : PredictionPageState.NoModelAvailable;

                SetPageState(state);
            });

            BrowseMediaCommand = new Command(async() => await PickPhoto());
        }
예제 #3
0
 public PageStateEventArgs(PredictionPageState state)
 {
     State = state;
 }