예제 #1
0
        static void Main(string[] args)
        {
            ICommand     command     = null;
            IHostService hostService = null;

            // Get Host Service for this OS
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                hostService = new WindowsHostService();
            }

            if (hostService is null)
            {
                Console.Error.WriteLine("OS is not supported.");
                Environment.Exit(1);
            }

            // Init Command Line App
            CommandLineApplication commandLineApplication = new CommandLineApplication();

            // Show Command
            commandLineApplication.Command("show", (app) =>
            {
                command = new ShowCommand();
                command.Execute(app, hostService);
            });
        }
예제 #2
0
        public AppNotifyIcon(IContainer container)
        {
            container.Add(this);

            InitializeComponent();

            notifyIcon.Icon           = Resources.Resource.timermaid;
            notifyIcon.DoubleClick   += (sender, e) => ShowCommand?.Execute(null);
            notifyIconMenuShow.Click += (sender, e) => ShowCommand?.Execute(null);
            notifyIconMenuQuit.Click += (sender, e) => QuitCommand?.Execute(null);
        }
예제 #3
0
        private void ToolTip_Opened(object sender, RoutedEventArgs e)
        {
            if (ToolTipOnDemand)
            {
                var toolTip = sender as ToolTip;
                toolTip.Visibility = toolTip.ActualWidth < AssociatedObject.ActualWidth ? Visibility.Hidden : Visibility.Visible;
                //toolTip.MinWidth = AssociatedObject.ActualWidth;
                //toolTip.MinHeight = AssociatedObject.ActualHeight;
            }

            if (ShowCommand != null)
            {
                if (ShowCommand.CanExecute(AssociatedObject?.DataContext))
                {
                    ShowCommand.Execute(AssociatedObject?.DataContext);
                }
            }
        }