コード例 #1
0
ファイル: App.xaml.cs プロジェクト: eastcoasttech/brizbee
 void icon_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         icon.ContextMenuStrip.Show();
     }
     else
     {
         MainWindow = new WizardWindow();
         MainWindow.Show();
         MainWindow.Focus();
     }
 }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: eastcoasttech/brizbee
        public App()
        {
            var config = new NLog.Config.LoggingConfiguration();

            // Setup loggers.
            var logfile = new NLog.Targets.FileTarget("logfile")
            {
                FileName = "file.txt"
            };
            var logconsole = new NLog.Targets.ConsoleTarget("logconsole");

            // Rules for mapping loggers.
            config.AddRule(LogLevel.Debug, LogLevel.Fatal, logconsole);
            config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);

            // Apply configuration to logger.
            LogManager.Configuration = config;

            // Initialize MessageBus Using Dispatcher
            Action <Action> uiThreadMarshaller =
                action => Dispatcher.Invoke(DispatcherPriority.Normal, action);

            Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            // Configure the tray icon.
            Assembly a  = Assembly.GetExecutingAssembly();
            Stream   st = a.GetManifestResourceStream("Brizbee.Integration.Utility.Images.favicon.ico");

            icon.Icon    = new Icon(st);
            icon.Visible = true;
            icon.ShowBalloonTip(2000, "BRIZBEE Integration Utility", "Started", ToolTipIcon.Info);
            icon.MouseClick += icon_MouseClick;

            var strip = new ContextMenuStrip();

            strip.Items.Add("Open...");
            strip.Items.Add("-");
            strip.Items.Add("Send Log Files...");
            strip.Items.Add("-");
            strip.Items.Add("Exit");

            strip.ItemClicked += contexMenuStrip_ItemClicked;

            icon.ContextMenuStrip = strip;

            // Show the main window on first startup.
            MainWindow = new WizardWindow();
            MainWindow.Show();
            MainWindow.Focus();
        }