private async void AssignKey( object sender, RoutedEventArgs e ) { AssignAuth RequestBox = new AssignAuth( new AESManager(), "Assign Key" ); await Popups.ShowDialog( RequestBox ); if ( RequestBox.Canceled || RequestBox.SelectedAuth == null ) return; Crypt = ( CryptAES ) RequestBox.SelectedAuth; }
private void SetTemplate() { LayoutRoot.DataContext = BindItem; if( BindItem.Encrypted ) { ReqTarget = SHTarget.KEY; Crypt = ( CryptAES ) new AESManager().GetAuthById( BindItem.Id ); } BottomControls = new ObservableCollection<PaneNavButton>(); AccessToken = ( string ) new TokenManager().GetAuthById( BindItem.Id )?.Value; XGrant.SetParameter( BindItem.Id, BookStorage.TimeKey ); if ( !string.IsNullOrEmpty( AccessToken ) ) { TransitionDisplay.SetState( AccessControls, TransitionState.Active ); } AvailControls = new Dictionary<string, PaneNavButton>() { { "Download", new PaneNavButton( new IconLogin() { AutoScale = true, Direction = Direction.Rotate270 }, Download ) } , { "Comment", new PaneNavButton( new IconComment() { AutoScale = true }, ToggleComments ) } , { "HideComment", new PaneNavButton( new IconNavigateArrow() { AutoScale = true, Direction = Direction.MirrorHorizontal }, ToggleComments ) } , { "NewComment", new PaneNavButton( new IconPlusSign() { AutoScale = true }, () => { StringResources stx = new StringResources( "AppBar" ); CCTarget = SHTarget.SCRIPT; CCId = BindItem.Id; NewComment( stx.Str( "AddComment" ) ); } ) } , { "OpenRequest", new PaneNavButton( new IconKeyRequest() { AutoScale = true }, ToggleRequests ) } , { "KeyRequest", new PaneNavButton( new IconRawDocument() { AutoScale = true }, () => { ShowRequest( SHTarget.KEY ); } ) } , { "TokenRequest", new PaneNavButton( new IconMasterKey() { AutoScale = true }, () => { ShowRequest( SHTarget.TOKEN ); } ) } , { "CloseRequest", new PaneNavButton( new IconNavigateArrow() { AutoScale = true, Direction = Direction.MirrorHorizontal }, ToggleRequests ) } , { "Submit", new PaneNavButton( new IconTick() { AutoScale = true }, SubmitComment ) } , { "Discard", new PaneNavButton( new IconCross() { AutoScale = true }, DiscardComment ) } }; DisplayControls( HomeControls ); ControlsList.ItemsSource = BottomControls; CommentStory = new Storyboard(); CommentStory.Completed += CommentStory_Completed; RequestStory = new Storyboard(); RequestStory.Completed += RequestStory_Completed; Member = X.Singleton<IMember>( XProto.SHMember ); Unloaded += ScriptDetails_Unloaded; }