/*Maching permissions * * http://blog.falafel.com/entity-framework-enum-flags/ * * // Only return records that have ALL specified colors * ColorFlags colorsToMatch = ColorFlags.Blue | ColorFlags.Red; * var matchingColors = db.Cars.Where(c => c.Color & colorsToMatch == colorsToMatch); * * * * // Return records that have ANY of the specified colors * ColorFlags colorsToMatch = ColorFlags.Blue | ColorFlags.Red; * var matchingColors = db.Cars.Where(c => c.Color & colorsToMatch != 0); * * */ public bool IsActionPermited(EventManage fullPatch, Guid uid) { var role = Participants.FirstOrDefault(x => x.UserInformation.ID == uid); if (role == null) { return(false); } return(role.AccessStatus == AccessStatus.Administrator || role.AccessStatus == AccessStatus.Owner); }
private async void DeleteMenuFlyout_Click(object sender, RoutedEventArgs e) { EventManage selectedEventManage = ((MenuFlyoutItem)sender).DataContext as EventManage; string EventFileTitle = selectedEventManage.EventFileTitle; StorageFile file = await applicationFolder.GetFileAsync(EventFileTitle); await file.DeleteAsync(); refreshList(); if (SecondaryTile.Exists(EventFileTitle)) { SecondaryTile secondaryTile = new SecondaryTile(EventFileTitle); await secondaryTile.RequestDeleteAsync(); } }
private void EditMenuFlyout_Click(object sender, RoutedEventArgs e) { EventManage selectedEventManage = ((MenuFlyoutItem)sender).DataContext as EventManage; Frame.Navigate(typeof(addpage), selectedEventManage); }
private async void PinMenuFlyout_Click(object sender, RoutedEventArgs e) { EventManage selectedEventManage = ((MenuFlyoutItem)sender).DataContext as EventManage; string EventFileTitle = selectedEventManage.EventFileTitle; string EventFileRemarks = selectedEventManage.EventFileRemarks; string EventFileDateRemain = selectedEventManage.EventFileDateRemain; if (Int32.Parse(EventFileDateRemain) < 0) { EventFileDateRemain = (-Int32.Parse(EventFileDateRemain)).ToString(); } ; string EventFileDate = selectedEventManage.EventFileDate; Debug.WriteLine(EventFileTitle); string tileId = EventFileTitle; if (SecondaryTile.Exists(tileId)) { await new MessageDialog("已存在").ShowAsync(); } else { try { Uri square71x71Logo = new Uri("ms-appx:///Assets/Square71x71Logo.scale-240.png"); Uri square150x150Logo = new Uri("ms-appx:///Assets/Square71x71Logo.scale-240.png"); Uri wide310x150Logo = new Uri("ms-appx:///Assets/WideLogo.scale-240.png"); SecondaryTile msecondaryTile = new SecondaryTile(tileId, "倒数计事", tileId, square150x150Logo, TileSize.Wide310x150); msecondaryTile.VisualElements.Wide310x150Logo = wide310x150Logo; msecondaryTile.VisualElements.Square150x150Logo = square150x150Logo; msecondaryTile.VisualElements.Square71x71Logo = square71x71Logo; msecondaryTile.VisualElements.ShowNameOnSquare150x150Logo = false; bool isPinned = await msecondaryTile.RequestCreateAsync(); XmlDocument wideTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150BlockAndText01); XmlNodeList wideTileTextAttributes = wideTileXml.GetElementsByTagName("text"); wideTileTextAttributes[0].AppendChild(wideTileXml.CreateTextNode(EventFileDateRemain)); wideTileTextAttributes[2].AppendChild(wideTileXml.CreateTextNode(tileId)); if (DateTime.Now.Date < DateTime.Parse(EventFileDate)) { wideTileTextAttributes[1].AppendChild(wideTileXml.CreateTextNode("剩余")); } else { wideTileTextAttributes[1].AppendChild(wideTileXml.CreateTextNode("已过")); } if (EventFileRemarks != "") { wideTileTextAttributes[3].AppendChild(wideTileXml.CreateTextNode(EventFileRemarks)); } else { wideTileTextAttributes[3].AppendChild(wideTileXml.CreateTextNode("无备注")); } XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Text01); XmlNodeList squareTileXmlAttributes = squareTileXml.GetElementsByTagName("text"); squareTileXmlAttributes[0].AppendChild(squareTileXml.CreateTextNode(tileId)); squareTileXmlAttributes[1].AppendChild(squareTileXml.CreateTextNode(EventFileRemarks)); if (DateTime.Now.Date < DateTime.Parse(EventFileDate)) { squareTileXmlAttributes[2].AppendChild(squareTileXml.CreateTextNode("剩余 " + EventFileDateRemain + " 天")); } else { squareTileXmlAttributes[2].AppendChild(squareTileXml.CreateTextNode("已过 " + EventFileDateRemain + " 天")); } var TileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(tileId); ScheduledTileNotification wideSchedule = new ScheduledTileNotification(wideTileXml, DateTimeOffset.Now.AddSeconds(5)); ScheduledTileNotification squareSchedule = new ScheduledTileNotification(squareTileXml, DateTimeOffset.Now.AddSeconds(5)); TileUpdater.Clear(); TileUpdater.EnableNotificationQueue(true); TileUpdater.AddToSchedule(squareSchedule); TileUpdater.AddToSchedule(wideSchedule); } catch (ArgumentException) { } } }