Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         LockScreen.hide();
     }
 }
 ///
 /// ------------------------------------------------------------------------------------------------
 /// Name        OnSaveClicked
 /// ------------------------------------------------------------------------------------------------
 ///
 /// <summary>   Handles a click on the save button.
 /// </summary>
 /// ------------------------------------------------------------------------------------------------
 ///
 private async Task OnSaveClicked(object sender, EventArgs e)
 {
     try
     {
         if (_isExecute)
         {
             Lbl_VisitSave.IsVisible = Lbl_VisitSave.IsEnabled = Boxvw_Save.IsEnabled = false;
             _isExecute = false;
             Exception error;
             SaveVisit();
             AppData.PropertyModel.SaveVisit(out error);
             if (error == null)
             {
                 Cancel();
                 AppContext.AppContext.RefreshVistsList.Invoke(sender, e);
                 AppContext.AppContext.InspectionCell.RefreshList();
                 if (AppData.PropertyModel.SelectedVisit.Visit.Status == SyncStatus.New)
                 {
                     AppData.PropertyModel.SelectedVisit.Visit.Visit.Status = SyncStatus.New;
                 }
             }
             else
             {
                 await LockScreen.ToDisplayAlert(this, "Save Failed", error.Message, "Ok");
             }
             _isExecute = true;
             Lbl_VisitSave.IsVisible = Lbl_VisitSave.IsEnabled = Boxvw_Save.IsEnabled = true;
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
        ///
        /// ------------------------------------------------------------------------------------------------
        /// Name        AddActionClick
        /// ------------------------------------------------------------------------------------------------
        ///
        /// <summary> Handles a click on add action
        /// </summary>
        /// ------------------------------------------------------------------------------------------------
        ///
        private void AddActionClick(object sender, EventArgs e)
        {
            try
            {
                SRiVisitMeta visit = AppData.PropertyModel.SelectedVisit.Visit;
                if (!AppData.ConfigModel.Actions(visit.Organisation, visit.Visit.VisitType).Any())
                {
                    LockScreen.ToDisplayAlert(this, "Cannot add Action", "No action types set up in Uniform for this visit type. Please contact your Uniform administrator for assistance.", "OK");
                }
                else
                {
                    Task.Delay(250);
                    PopupContent.ShowPopupRelative(new AddActionView(this, PopupContent), BX_AddActions, Width * 0.40, GetHeight(GroupedListViewModel.Count), true, "");
                    if (Device.OS != TargetPlatform.iOS)
                    {
                        PopupContent._triangleImage.Source = "";
                    }

                    AppData.PropertyModel.SelectedAction = new SelectedAction(new SRiAction()
                    {
                        DueDate     = DateTime.Now,
                        VisitKeyVal = visit.Visit.KeyVal,
                        MDKeyVal    = visit.Visit.MDKeyVal,
                        MDSubSys    = visit.Visit.MDSubSys,
                        Paragraphs  = new List <SRiActionParagraph>()
                    }, AppData.PropertyModel.SelectedVisit.NewActionMapping, true);
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        /// <summary>
        ///  アイテムをロック画面に設定する.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        private async Task <bool> SetSelectedItemToLockscreenAsync(LockscreenImageItem item)
        {
            bool succeedToSet = false;

            try
            {
                await LockScreen.SetImageFileAsync(item.Item);

                succeedToSet = true;
            }
            catch (UnauthorizedAccessException)
            {
                // 画像ファイルを貼り付けしてその直後に
                // ロック画面に設定しようとすると↑はアクセス拒否で失敗する。
                // その場合でも↓で問題ないのでそれを試す。
                // もしかしたら常に↓でよいのかもしれない...
            }

            if (!succeedToSet)
            {
                using (var strm = await item.Item.OpenReadAsync())
                {
                    await LockScreen.SetImageStreamAsync(strm);

                    succeedToSet = true;
                }
            }

            return(succeedToSet);
        }
Beispiel #5
0
        private void SetAsWallpaper(string filename)
        {
            string realPath = "ms-appdata:///local/" + filename;

            LockScreen.SetImageUri(new Uri(realPath, UriKind.Absolute));
            GlobalLoading.Instance.SetTimedText(AppResources.MessagePatternOnLockscreen);
            FlurryWP8SDK.Api.LogEvent("Wallpaper.SetLockscreen");
        }