public MainWindow() { InitializeComponent(); Messenger.Default.Register <SugarTakenMessage>(this, async message => { var sugarIcon = new PackIconMaterial() { Kind = PackIconMaterialKind.CubeOutline }; var bigCubeX = Canvas.GetLeft(bigSugarCube) + 25; var bigCubeY = Canvas.GetTop(bigSugarCube) + 25; var miniCubeX = 310; var miniCubeY = 69 * message.ConveyorIndex + 35; await MoveIcon(message, sugarIcon, bigCubeX, bigCubeY, miniCubeX, miniCubeY, message.Conveyor.ProcessingTime); if (message.Conveyor.IsCrashed) { return; } var candyIcon = new PackIconMaterial() { Kind = PackIconMaterialKind.Candycane }; var humanX = 310; var candyY = 69 * message.ConveyorIndex + 35; var endX = humanX + 200; await MoveIcon(message, candyIcon, humanX, candyY, endX, candyY, message.Conveyor.ProcessingTime); }); }
public ConfigJumpMenuItem( IContextMenuTranslations contextMenuTranslations, IWindowManager windowManager, ConfigViewModel configViewModel, LanguageConfigViewModel languageConfigViewModel ) { // automatically update the DisplayName contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.JumpToConfigure)); Id = "G_ConfigJump"; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Settings, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch }; ClickAction = clickedItem => { configViewModel.CurrentConfigScreen = languageConfigViewModel; if (!configViewModel.IsActive) { windowManager.ShowDialog(configViewModel); } }; this.ApplyIconForegroundColor(Brushes.Gray); }
public ConfigMenuItem( ICoreTranslations coreTranslations, IWindowManager windowsManager, Func <Owned <ConfigViewModel> > configViewModelFactory ) { Id = "D_Configure"; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Settings }; ClickAction = clickedItem => { IsEnabled = false; try { using var configViewModel = configViewModelFactory(); windowsManager.ShowDialog(configViewModel.Value); } finally { // TODO: Check why this might cause a NullReferenceException in the PresentationFramework at System.Windows.DeferredAppResourceReference.GetValue(BaseValueSourceInternal valueSource) IsEnabled = true; } }; coreTranslations.CreateDisplayNameBinding(this, nameof(ICoreTranslations.Configure)); }
public AdaptiveCardMenuItem(AdaptiveHostConfig adaptiveHostConfig, IEventAggregator eventAggregator, IContextMenuTranslations contextMenuTranslations) { // automatically update the DisplayName contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.ActiveCard)); Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Cards }; ClickAction = clickedItem => { Log.Debug().WriteLine("ActiveCard"); var card = new AdaptiveCard("1.1") { Body = new List <AdaptiveElement> { new AdaptiveImage { HorizontalAlignment = AdaptiveHorizontalAlignment.Center, Size = AdaptiveImageSize.Large, Url = new Uri("http://static.nichtlustig.de/comics/full/150422.jpg") }, new AdaptiveImage { HorizontalAlignment = AdaptiveHorizontalAlignment.Center, Size = AdaptiveImageSize.Large, Url = new Uri("http://static.nichtlustig.de/comics/full/150421.jpg") } }, Actions = new List <AdaptiveAction> { new AdaptiveShowCardAction { Title = "Do you like this?", Card = new AdaptiveCard("1.1") { Body = new List <AdaptiveElement> { new AdaptiveTextInput { Id = "rating" } } } } } }; eventAggregator.PublishOnCurrentThread(new AdaptiveCardViewModel(adaptiveHostConfig, card, eventAggregator)); }; this.VisibleOnPermissions("Admin"); }
public ApplicationViewInfo(ApplicationViewManager.Name name, PackIconMaterial packIconMaterial) { Name = name; TranslatedName = ApplicationViewManager.GetTranslatedNameByName(name); var canvas = new Canvas(); canvas.Children.Add(packIconMaterial); Icon = canvas; }
/// <summary> /// The constructor for the history MenuItem /// </summary> /// <param name="dopyContextMenuTranslations"></param> public RestoreMenuItem(IDopyTranslations dopyContextMenuTranslations) { // automatically update the DisplayName dopyContextMenuTranslations.CreateDisplayNameBinding(this, nameof(IDopyTranslations.Restore)); Id = "A_Restore"; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Restore }; }
public override void Initialize() { Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Settings, Spin = true, SpinDuration = 3 }; HotKeyHint = "Alt+C"; }
public HomeViewModel(ShellViewModel shellViewModel, IComponentContext context) : base(shellViewModel, context) { UpdateUI(); Tag = this; Icon = new PackIconMaterial() { Kind = PackIconMaterialKind.Home }; }
public SettingsViewModel(ShellViewModel shellViewModel, IComponentContext context) : base(shellViewModel, context) { UpdateUI(); Tag = this; Icon = new PackIconMaterial() { Kind = PackIconMaterialKind.SettingsHelper }; }
/// <summary> /// The constructor for the history MenuItem /// </summary> /// <param name="dopyContextMenuTranslations"></param> public TitleMenuItem(IDopyTranslations dopyContextMenuTranslations) { // automatically update the DisplayName dopyContextMenuTranslations.CreateDisplayNameBinding(this, nameof(IDopyTranslations.Process)); Id = "_Title"; Style = MenuItemStyles.Title; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Clipboard }; }
private void Button_Click(object sender, RoutedEventArgs e) { var packIcon = new PackIconMaterial() { Kind = PackIconMaterialKind.Heart, Height = 23, Width = 23 }; HeartIcon.IconResource = packIcon; }
public override void Initialize() { Id = "A_SaveAs"; ParentId = "1_File"; // automatically update the DisplayName _menuTranslations.CreateDisplayNameBinding(this, nameof(IMenuTranslations.SaveAs)); Icon = new PackIconMaterial { Kind = PackIconMaterialKind.ContentSave }; }
public SettingsViewInfo(SettingsViewManager.Name name, PackIconMaterial packIconMaterial, SettingsViewManager.Group group) { Name = name; TranslatedName = SettingsViewManager.TranslateName(name, group); Canvas canvas = new Canvas(); canvas.Children.Add(packIconMaterial); Icon = canvas; Group = group; TranslatedGroup = SettingsViewManager.TranslateGroup(group); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { StackPanel stackPanel = new StackPanel() { Orientation = Orientation.Horizontal }; PackIconBase icon = null; string text = ""; ResourceManager resourceManager = new ResourceManager(typeof(Properties.Resources)); GitHubRelease release = (GitHubRelease)value; switch (release.ReleaseTimeType) { case GitHubReleaseTimeTypes.OLD: icon = new PackIconMaterial() { Kind = PackIconMaterialKind.History }; text = resourceManager.GetString("DowngradeString"); break; case GitHubReleaseTimeTypes.CURRENT: icon = new PackIconOcticons() { Kind = PackIconOcticonsKind.Tools }; text = resourceManager.GetString("RepairString"); break; case GitHubReleaseTimeTypes.NEW: icon = new PackIconOcticons() { Kind = PackIconOcticonsKind.DesktopDownload }; text = resourceManager.GetString("UpgradeString"); break; } icon.Width = 20; icon.Height = double.NaN; icon.Margin = new System.Windows.Thickness(5, 0, 10, 0); icon.VerticalAlignment = System.Windows.VerticalAlignment.Center; stackPanel.Children.Add(icon); stackPanel.Children.Add(new TextBlock(new Run(text)) { FontSize = 12, VerticalAlignment = System.Windows.VerticalAlignment.Center }); return(stackPanel); }
/// <summary> /// Initialize the exit menu item /// </summary> public override void Initialize() { Id = "Z_Exit"; // automatically update the DisplayName _contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.Exit)); Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Close }; this.ApplyIconForegroundColor(Brushes.DarkRed); }
/// <summary> /// The constructor for the history MenuItem /// </summary> /// <param name="dopyContextMenuTranslations"></param> /// <param name="clipRepository">IClipRepository to perform actions on</param> public DeleteMenuItem(IDopyTranslations dopyContextMenuTranslations, IClipRepository clipRepository) { _clipRepository = clipRepository; // automatically update the DisplayName dopyContextMenuTranslations.CreateDisplayNameBinding(this, nameof(IDopyTranslations.Delete)); Id = "B_Delete"; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Delete }; }
public void UpdateImage(string url) { var stackPanel = new StackPanel() { Orientation = Orientation.Horizontal }; var transformGroup = new TransformGroup(); var skewTransform = new SkewTransform(0, 0, 0, 0); var rotateTransform = new RotateTransform(0); var scale = new ScaleTransform(-1, 1); var origin = new Point(0.4, 0.3); transformGroup.Children.Add(rotateTransform); transformGroup.Children.Add(skewTransform); transformGroup.Children.Add(scale); var packIconMaterial = new PackIconMaterial() { Kind = PackIconMaterialKind.ThumbDownOutline, Width = 36, Height = 36, RenderTransformOrigin = origin, RenderTransform = transformGroup, }; stackPanel.Children.Add(packIconMaterial); var textBlock = new TextBlock() { Text = "Dislike", VerticalAlignment = VerticalAlignment.Top, FontSize = 24, }; stackPanel.Children.Add(textBlock); this.DislikeButton.Content = stackPanel; var packIcon = new PackIconMaterial() { Kind = PackIconMaterialKind.HeartOutline, Height = 23, Width = 23 }; HeartIcon.IconResource = packIcon; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(url, UriKind.Absolute); bitmap.EndInit(); image.Source = bitmap; }
public static void ApplyPackIcon(Control control, string packIconKey) { string packIconKind = packIconKey; object packIconControl = control.Template .FindName("PackIcon", control) as object; if (packIconControl is PackIconMaterial) { PackIconMaterial packIcon = (PackIconMaterial)packIconControl; packIcon.Kind = (PackIconMaterialKind)Enum .Parse(typeof(PackIconMaterialKind), packIconKind); } else if (packIconControl is PackIconMaterialLight) { PackIconMaterialLight packIconLight = (PackIconMaterialLight)packIconControl; packIconLight.Kind = (PackIconMaterialLightKind)Enum .Parse(typeof(PackIconMaterialLightKind), packIconKind); } else if (packIconControl is PackIconModern) { PackIconModern packIconModern = (PackIconModern)packIconControl; packIconModern.Kind = (PackIconModernKind)Enum .Parse(typeof(PackIconModernKind), packIconKind); } else if (packIconControl is PackIconOcticons) { PackIconOcticons packIconOcticons = (PackIconOcticons)packIconControl; packIconOcticons.Kind = (PackIconOcticonsKind)Enum .Parse(typeof(PackIconOcticonsKind), packIconKind); } else if (packIconControl is PackIconSimpleIcons) { PackIconSimpleIcons packIconSimple = (PackIconSimpleIcons)packIconControl; packIconSimple.Kind = (PackIconSimpleIconsKind)Enum .Parse(typeof(PackIconSimpleIconsKind), packIconKind); } else if (packIconControl is PackIconEntypo) { PackIconEntypo packIconSimple = (PackIconEntypo)packIconControl; packIconSimple.Kind = (PackIconEntypoKind)Enum .Parse(typeof(PackIconEntypoKind), packIconKind); } else if (packIconControl is PackIconFontAwesome) { PackIconFontAwesome packIconSimple = (PackIconFontAwesome)packIconControl; packIconSimple.Kind = (PackIconFontAwesomeKind)Enum .Parse(typeof(PackIconFontAwesomeKind), packIconKind); } }
public TitleMenuItem(IMainContextMenuTranslations contextMenuTranslations) { // automatically update the DisplayName contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IMainContextMenuTranslations.Title)); Id = "A_Title"; Style = MenuItemStyles.Title; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Clipboard }; this.ApplyIconForegroundColor(Brushes.SaddleBrown); }
/// <summary> /// Create the title of the context menu /// </summary> public override void Initialize() { Id = "A_Title"; // automatically update the DisplayName _contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.Title)); Style = MenuItemStyles.Title; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Web }; this.ApplyIconForegroundColor(Brushes.DarkRed); }
/// <summary> /// Configure the title menu item /// </summary> /// <param name="contextMenuTranslations">IContextMenuTranslations</param> public TitleMenuItem(IContextMenuTranslations contextMenuTranslations) { // automatically update the DisplayName contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.Title)); Id = "A_Title"; Style = MenuItemStyles.Title; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Exclamation }; this.ApplyIconForegroundColor(Brushes.DarkRed); }
/// <summary> /// The constructor for the history MenuItem /// </summary> /// <param name="dopyContextMenuTranslations"></param> /// <param name="windowManager"></param> /// <param name="historyViewModelFactory"></param> public HistoryMenuItem( IDopyTranslations dopyContextMenuTranslations, IWindowManager windowManager, Func <Owned <HistoryViewModel> > historyViewModelFactory ) { // automatically update the DisplayName dopyContextMenuTranslations.CreateDisplayNameBinding(this, nameof(IDopyTranslations.History)); Id = "Y_History"; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.History }; // Key to react to var controlShiftPasteKey = new KeyCombinationHandler(VirtualKeyCode.Control, VirtualKeyCode.Shift, VirtualKeyCode.KeyV); KeyboardHook.KeyboardEvents // The hotkey to listen do .Where(controlShiftPasteKey) #if !NETCOREAPP3_1 // TODO: What about dotnet core 3.0? // Make sure it's on the dispatcher .SubscribeOnDispatcher() #endif // What to do .Subscribe(args => { if (IsEnabled) { Click(this); } args.Handled = true; }); HotKeyHint = "Ctrl + Shift + V"; ClickAction = clickedItem => { IsEnabled = false; try { using var historyViewModel = historyViewModelFactory(); windowManager.ShowDialog(historyViewModel.Value); } finally { IsEnabled = true; } }; }
private void DislikeButton_Click(object sender, RoutedEventArgs e) { reacted = !reacted; string _path = Directory.GetCurrentDirectory() + "\\usersettings.json"; string jsonFromFile = File.ReadAllText(_path); dynamic jsonObj = JsonConvert.DeserializeObject(jsonFromFile); jsonObj["jokeCategory"][currentCategory] -= 1; string output = JsonConvert.SerializeObject(jsonObj, Formatting.Indented); File.WriteAllText(_path, output); var stackPanel = new StackPanel() { Orientation = Orientation.Horizontal }; var transformGroup = new TransformGroup(); var skewTransform = new SkewTransform(0, 0, 0, 0); var rotateTransform = new RotateTransform(0); var scale = new ScaleTransform(-1, 1); var origin = new Point(0.4, 0.3); transformGroup.Children.Add(rotateTransform); transformGroup.Children.Add(skewTransform); transformGroup.Children.Add(scale); var packIconMaterial = new PackIconMaterial() { Kind = PackIconMaterialKind.ThumbDown, Width = 36, Height = 36, RenderTransformOrigin = origin, RenderTransform = transformGroup, }; stackPanel.Children.Add(packIconMaterial); var textBlock = new TextBlock() { Text = "Dislike", VerticalAlignment = VerticalAlignment.Top, FontSize = 24, }; stackPanel.Children.Add(textBlock); this.DislikeButton.Content = stackPanel; //HeartIcon.Background = new SolidColorBrush(Colors.Transparent); //DislikeIcon.Background = new SolidColorBrush(Colors.Blue); }
// close button for tab in c# public static PackIconMaterial GetCloseButtonIcon() { PackIconMaterial packIconMaterial = new PackIconMaterial() { Kind = PackIconMaterialKind.Close, Margin = new Thickness(2, 2, 2, 2), Width = 14, Height = 14, Foreground = new SolidColorBrush(Colors.Black), Background = new SolidColorBrush(Colors.White) }; return(packIconMaterial); }
/// <summary> /// Configure the exit menu item /// </summary> /// <param name="contextMenuTranslations"></param> public ExitMenuItem(IContextMenuTranslations contextMenuTranslations) { // automatically update the DisplayName contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.Exit)); Id = "Z_Exit"; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Close, }; ClickAction = clickedItem => { Application.Current.Shutdown(); }; this.ApplyIconForegroundColor(Brushes.DarkRed); }
public IconButton() { BorderBrush = Brushes.Transparent; BorderThickness = new Thickness(0); Background = Brushes.Transparent; Foreground = Brushes.Transparent; Content = new PackIconMaterial { Width = double.NaN, Height = double.NaN, Margin = IconMargin, Kind = IconMaterialKind, Foreground = IconForeground, }; }
public CreateErrorMenuItem(IContextMenuTranslations contextMenuTranslations) { // automatically update the DisplayName contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.CreateError)); Id = "X_Error"; Icon = new PackIconMaterial { Kind = PackIconMaterialKind.Exclamation, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch }; ClickAction = clickedItem => throw new NotSupportedException("This should be shown in an error windows!"); this.ApplyIconForegroundColor(Brushes.DarkRed); }
public ContextMenu getContextMenu() { var IconEdit = new PackIconMaterial() { Kind = PackIconMaterialKind.Pen, Margin = new Thickness(4, 4, 2, 4), Width = 14, Height = 14, VerticalAlignment = VerticalAlignment.Center }; var IconDelete = new PackIconMaterial() { Kind = PackIconMaterialKind.Delete, Margin = new Thickness(4, 4, 2, 4), Width = 14, Height = 14, VerticalAlignment = VerticalAlignment.Center }; //Contexte menu ContextMenu contextMenu = new ContextMenu(); MenuItem menuItem = new MenuItem() { Header = "Éditer" }; menuItem.Click += new RoutedEventHandler(ContextMenu_Update); menuItem.Icon = IconEdit; contextMenu.Items.Add(menuItem); menuItem = new MenuItem() { Header = "Supprimer" }; menuItem.Click += new RoutedEventHandler(ContextMenu_Delete); menuItem.Icon = IconDelete; contextMenu.Items.Add(menuItem); return(contextMenu); }
public WizardMenuItem( IContextMenuTranslations contextMenuTranslations, IWindowManager windowManager, WizardExampleViewModel wizardExample) { // automatically update the DisplayName // automatically update the DisplayName contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.Wizard)); Icon = new PackIconMaterial { Kind = PackIconMaterialKind.AutoFix }; ClickAction = clickedItem => { windowManager.ShowDialog(wizardExample); }; this.EnabledOnPermissions("Admin"); }
private void FullscreenButton_Click(object sender, RoutedEventArgs e) { PackIconMaterial icon = new PackIconMaterial(); icon.Width = 12; icon.Height = 12; icon.HorizontalAlignment = HorizontalAlignment.Center; icon.VerticalAlignment = VerticalAlignment.Center; if (isFullscreen) { mainGrid.RowDefinitions[1].Height = new GridLength(60); WindowState = windowState; this.ResizeMode = ResizeMode.CanResizeWithGrip; this.IgnoreTaskbarOnMaximize = false; ShowTitleBar = true; this.UseNoneWindowStyle = false; this.WindowStyle = WindowStyle.SingleBorderWindow; isFullscreen = false; icon.Kind = PackIconMaterialKind.Fullscreen; fullscreenButton.Content = icon; } else { mainGrid.RowDefinitions[1].Height = new GridLength(0); windowState = this.WindowState; this.WindowState = WindowState.Maximized; this.ResizeMode = ResizeMode.NoResize; this.IgnoreTaskbarOnMaximize = true; ShowTitleBar = false; this.WindowStyle = WindowStyle.None; isFullscreen = true; icon.Kind = PackIconMaterialKind.FullscreenExit; fullscreenButton.Content = icon; } }