예제 #1
0
 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);
 }
예제 #2
0
 public SystemTrayContextMenuViewModel(IContextMenuTranslations contextMenuTranslations,
                                       [ImportMany("contextmenu", typeof(IMenuItem))]
                                       IEnumerable <Lazy <IMenuItem> > contextMenuItems)
 {
     _contextMenuTranslations = contextMenuTranslations;
     _contextMenuItems        = contextMenuItems;
 }
예제 #3
0
 /// <summary>
 /// Creates the tray icon
 /// </summary>
 /// <param name="trayIconManager">ITrayIconManager</param>
 /// <param name="contextMenuItems">IEnumerable IMenuItem</param>
 /// <param name="contextMenuTranslations">IContextMenuTranslations</param>
 public ExchangeTrayIconViewModel(
     ITrayIconManager trayIconManager,
     [MetadataFilter("Menu", "systemtray")] IEnumerable <Lazy <IMenuItem> > contextMenuItems,
     IContextMenuTranslations contextMenuTranslations) : base(trayIconManager)
 {
     _contextMenuItems        = contextMenuItems;
     _contextMenuTranslations = contextMenuTranslations;
 }
        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");
        }
예제 #5
0
 public WindowWithMenuViewModel(
     IMenuTranslations menuTranslations,
     IContextMenuTranslations contextMenuTranslations,
     [MetadataFilter("Menu", "menu")] IEnumerable <Lazy <IMenuItem> > menuItems
     )
 {
     _menuTranslations        = menuTranslations;
     _contextMenuTranslations = contextMenuTranslations;
     _menuItems = menuItems;
 }
예제 #6
0
 /// <inheritdoc />
 public WapploTrayIconViewModel(
     IEventAggregator eventAggregatore,
     IContextMenuTranslations contextMenuTranslations,
     ITrayIconManager trayIconManager,
     [MetadataFilter("Menu", "contextmenu")] IEnumerable <Lazy <IMenuItem> > contextMenuItems = null
     ) : base(trayIconManager)
 {
     _eventAggregator         = eventAggregatore;
     _contextMenuTranslations = contextMenuTranslations ?? throw new ArgumentNullException(nameof(contextMenuTranslations));
     _contextMenuItems        = contextMenuItems;
 }
        public ConfigMenuItem(
            IWindowManager windowManager,
            IContextMenuTranslations contextMenuTranslations,
            ConfigViewModel demoConfigViewModel)
        {
            // automatically update the DisplayName
            contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.Configure));

            _demoConfigViewModel = demoConfigViewModel;
            _windowManager       = windowManager;
        }
        /// <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);
        }
예제 #9
0
 /// <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);
 }
예제 #10
0
 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);
 }
예제 #11
0
 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");
 }
예제 #12
0
 public SabNzbTrayIconViewModel(
     IEnumerable <IMenuItem> contextMenuItems,
     IContextMenuTranslations contextMenuTranslations,
     ITrayIconManager trayIconManager,
     ICoreTranslations coreTranslations,
     IEventAggregator eventAggregator,
     IWindowManager windowsManager,
     MainScreenViewModel mainScreenViewModel,
     ConnectionViewModel connectionViewModel
     ) : base(trayIconManager)
 {
     _trayIconManager         = trayIconManager;
     _contextMenuItems        = contextMenuItems;
     _connectionViewModel     = connectionViewModel;
     _contextMenuTranslations = contextMenuTranslations;
     _coreTranslations        = coreTranslations;
     _eventAggregator         = eventAggregator;
     _mainScreenViewModel     = mainScreenViewModel;
     _windowsManager          = windowsManager;
 }
예제 #13
0
        public SomeWindowMenuItems(
            IWindowManager windowManager,
            IContextMenuTranslations contextMenuTranslations,
            WindowWithMenuViewModel windowWithMenuViewModel)
        {
            // automatically update the DisplayName
            contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.SomeWindow));

            Icon = new PackIconMaterial
            {
                Kind = PackIconMaterialKind.ViewList
            };
            ClickAction = clickedItem =>
            {
                Log.Debug().WriteLine("SomeWindow");
                windowManager.ShowWindow(windowWithMenuViewModel);
            };

            this.VisibleOnPermissions("Admin");
        }
예제 #14
0
        public ToastMenuItem(
            IEventAggregator eventAggregator,
            Func <Owned <ToastExampleViewModel> > toastExampleViewModelFactory,
            IContextMenuTranslations contextMenuTranslations)
        {
            // automatically update the DisplayName
            contextMenuTranslations.CreateDisplayNameBinding(this, nameof(IContextMenuTranslations.Toast));

            Icon = new PackIconMaterial
            {
                Kind = PackIconMaterialKind.MessageText
            };

            ClickAction = clickedItem =>
            {
                Log.Debug().WriteLine("Toast");
                ShowToast(eventAggregator, toastExampleViewModelFactory);
            };

            this.VisibleOnPermissions("Admin");
        }
예제 #15
0
 /// <inheritdoc />
 public TitleMenuItem(
     IContextMenuTranslations contextMenuTranslations)
 {
     _contextMenuTranslations = contextMenuTranslations;
 }
예제 #16
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="contextMenuTranslations">IContextMenuTranslations</param>
 public ExitMenuItem(
     IContextMenuTranslations contextMenuTranslations
     )
 {
     _contextMenuTranslations = contextMenuTranslations;
 }
예제 #17
0
 public WithChildrenMenuItem(
     IContextMenuTranslations contextMenuTranslations)
 {
     _contextMenuTranslations = contextMenuTranslations;
 }