private void OnContextMenuOpend(object sender, RoutedEventArgs e) { var cm = sender as ContextMenu; if (cm == null) { return; } var fse = mouseElement.DataContext as FileSystemEntity; if (fse == null) { cm.IsOpen = false; } else { FileBrowseListBox.SelectedItem = fse; bool isFolder = fse.Type == FileSystemEntityType.Folder; contextMenuiItems[0].Visibility = isFolder && AuthenticateStatus.CheckModuleAccess("100102") ? Visibility.Visible : Visibility.Collapsed; contextMenuiItems[1].Visibility = isFolder || !AuthenticateStatus.CheckModuleAccess("100102") ? Visibility.Collapsed : Visibility.Visible; contextMenuiItems[2].Visibility = (isFolder && AuthenticateStatus.CheckModuleAccess("100106") || (!isFolder && AuthenticateStatus.CheckModuleAccess("100107"))) ? Visibility.Visible : Visibility.Collapsed; contextMenuiItems[3].Visibility = isFolder && AuthenticateStatus.CheckModuleAccess("100108") ? Visibility.Visible : Visibility.Collapsed; contextMenuiItems[4].Visibility = isFolder || !AuthenticateStatus.CheckModuleAccess("100103") ? Visibility.Collapsed : Visibility.Visible; contextMenuiItems[5].Visibility = (isFolder && AuthenticateStatus.CheckModuleAccess("100401") || (!isFolder && AuthenticateStatus.CheckModuleAccess("100403"))) ? Visibility.Visible : Visibility.Collapsed; contextMenuiItems[6].Visibility = (isFolder && AuthenticateStatus.CheckModuleAccess("100402") || (!isFolder && AuthenticateStatus.CheckModuleAccess("100404"))) ? Visibility.Visible : Visibility.Collapsed; contextMenuiItems[7].Visibility = AuthenticateStatus.CheckModuleAccess("100405") ? Visibility.Visible : Visibility.Collapsed; } }
// Executes when the user navigates to this page. protected override void OnNavigatedTo(NavigationEventArgs e) { if (!AuthenticateStatus.CheckModuleAccess("100301")) { createMsgForm.Visibility = Visibility.Collapsed; Grid.SetColumnSpan(messagesStackpanel, 2); } LoadMessageList(); ShowPopupMessages(); }