Ejemplo n.º 1
1
        public Notificator(IEventLogger eventLogger, ISettingsManager settingsManager)
        {
            _eventLogger = eventLogger;
            _settingsManager = settingsManager;

            var menuItem = new MenuItem(Strings.Exit);
            menuItem.Click += menuItem_Click;
            var contextMenu = new ContextMenu(new[] {menuItem});
            _notifyIcon = new NotifyIcon
            {
                Icon = new Icon("TryIcon.ico"),
                Visible = true,
                BalloonTipTitle = Strings.Caution,
                Text = Strings.Initializing,
                ContextMenu = contextMenu
            };

            var oneRunTimer = new Timer(3000)
            {
                AutoReset = false,
                Enabled = true
            };
            oneRunTimer.Elapsed += _timer_Elapsed; // runs only once after aplication start

            var timer = new Timer(60000)
            {
                AutoReset = true,
                Enabled = true
            };
            timer.Elapsed += _timer_Elapsed;
        }
Ejemplo n.º 2
1
        private static void Main()
        {
            DefaultMediaDevice = new MMDeviceEnumerator().GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
            DefaultMediaDevice.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);

            TrayIcon = new NotifyIcon();
            TrayIcon.Icon = IconFromVolume();
            TrayIcon.Text = ToolTipFromVolume();
            TrayIcon.MouseClick += new MouseEventHandler(TrayIcon_MouseClick);
            TrayIcon.MouseDoubleClick += new MouseEventHandler(TrayIcon_MouseDoubleClick);
            TrayIcon.Visible = true;

            TrayIcon.ContextMenu = new ContextMenu();
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Open Volume Mixer", (o, e) => { Process.Start(SystemDir + "sndvol.exe"); }));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("-"));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Playback devices", (o, e) => { Process.Start(SystemDir + "rundll32.exe", @"Shell32.dll,Control_RunDLL mmsys.cpl,,playback"); }));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Recording devices", (o, e) => { Process.Start(SystemDir + "rundll32.exe", @"Shell32.dll,Control_RunDLL mmsys.cpl,,recording"); }));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Sounds", (o, e) => { Process.Start(SystemDir + "rundll32.exe", @"Shell32.dll,Control_RunDLL mmsys.cpl,,sounds"); }));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("-"));
            TrayIcon.ContextMenu.MenuItems.Add(new MenuItem("Volume control options", (o, e) => { Process.Start(SystemDir + "sndvol.exe", "-p"); }));

            SingleClickWindow = new Timer();
            SingleClickWindow.Interval = SystemInformation.DoubleClickTime;
            SingleClickWindow.Tick += (o, e) =>
                {
                    SingleClickWindow.Stop();
                    StartVolControl();
                };

            Application.Run();
        }
Ejemplo n.º 3
1
        public ShellView()
        {
            InitializeComponent();

            // Check if there was instance before this. If there was-close the current one.
            if (ProcessUtilities.ThisProcessIsAlreadyRunning())
            {
                ProcessUtilities.SetFocusToPreviousInstance("Carnac");
                Application.Current.Shutdown();
            }

            var item = new MenuItem
            {
                Text = "Exit"
            };

            item.Click += (sender, args) => Close();

            var iconStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Carnac.icon.embedded.ico");

            var ni = new NotifyIcon
                         {
                             Icon = new Icon(iconStream),
                             ContextMenu = new ContextMenu(new[] { item })
                         };

            ni.Click += NotifyIconClick;
            ni.Visible = true;
        }
Ejemplo n.º 4
1
        public MainWindow()
        {
            InitializeComponent();
            this.notifyIcon = new NotifyIcon();
            contextMenu = new ContextMenu();

            MenuItem refreshItem = new MenuItem();
            refreshItem.Click += new System.EventHandler(this.refreshQuestionNo);
            refreshItem.Text = "Refresh";
            contextMenu.MenuItems.Add(refreshItem);

            MenuItem openItem = new MenuItem();
            openItem.Click += new System.EventHandler(this.showApp);
            openItem.Text = "Show";
            contextMenu.MenuItems.Add(openItem);

            MenuItem exitItem = new MenuItem();
            exitItem.Click += new System.EventHandler(this.exitApp);
            exitItem.Text = "Exit";
            contextMenu.MenuItems.Add(exitItem);

            dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
        }
Ejemplo n.º 5
0
            public ConnectStatus(MainWindow window)
            {
                this.window = window;
                icon = new NotifyIcon();
                icon.Visible = true;

                icon.DoubleClick += (sender, e) => {
                    window.WindowState = System.Windows.WindowState.Normal;
                    window.Activate();
                };

                var menu = new ContextMenu();

                menu.MenuItems.Add(resources["AddRules"] as string, (sender, e) => {
                    Rules.OpenEditor(false);
                });

                menu.MenuItems.Add(resources["Exit"] as string, (sender, e) => {
                    System.Windows.Application.Current.Shutdown();
                });

                icon.ContextMenu = menu;

                SetStatus(Status.Stopped, resources["NotConnected"] as string);
                System.Windows.Application.Current.Exit += (sender, e) => {
                    icon.Dispose();
                };
            }
Ejemplo n.º 6
0
        public SysTrayApp()
        {
            // Create a simple tray menu with only one item.
            trayMenu = new ContextMenu();
            #if DEBUG
            trayMenu.MenuItems.Add("Register (DEBUG)", onDebugRegister);
            trayMenu.MenuItems.Add("Unregister (DEBUG)", onDebugUnregister);
            trayMenu.MenuItems.Add("-");
            trayMenu.MenuItems.Add("Add dummy client", onDebugAddDummy);
            trayMenu.MenuItems.Add("-");
            #endif
            trayMenu.MenuItems.Add("About", onAbout);
            trayMenu.MenuItems.Add("Client status", onStatus);
            trayMenu.MenuItems.Add("Test", onSelfTest);
            trayMenu.MenuItems.Add("Quit", OnQuit);

            // Create a tray icon. In this example we use a
            // standard system icon for simplicity, but you
            // can of course use your own custom icon too.
            trayIcon = new NotifyIcon();
            trayIcon.Text = "Notification Client";
            trayIcon.Icon = new Icon(Properties.Resources.systrayicon, 128, 128);

            // Add menu to tray icon and show it.
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible = true;

            start_notification_client();
        }
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.EnableStatusChanged += controller_EnableStatusChanged;
            controller.ConfigChanged += controller_ConfigChanged;
            controller.PACFileReadyToOpen += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged;
            controller.EnableGlobalChanged += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible = true;
            _notifyIcon.ContextMenu = contextMenu1;
            _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick;

            this.updateChecker = new UpdateChecker();
            updateChecker.NewVersionFound += updateChecker_NewVersionFound;

            LoadCurrentConfiguration();

            updateChecker.CheckUpdate(controller.GetConfigurationCopy());

            if (controller.GetConfigurationCopy().isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
        }
Ejemplo n.º 8
0
        public GUI()
        {
            InitializeComponent();

            RegisterHotKey(this.Handle, MYACTION_HOTKEY_ID, 0, (int)Keys.PrintScreen);

            // Create a simple tray menu with only one item.
            trayMenu = new ContextMenu();
            trayMenu.MenuItems.Add("Exit", OnExit);

            // Create a tray icon. In this example we use a
            // standard system icon for simplicity, but you
            // can of course use your own custom icon too.
            trayIcon = new NotifyIcon();
            trayIcon.Text = "PRTSC_TO_FILE";
            trayIcon.Icon = Properties.Resources.MainIcon;

            // Add menu to tray icon and show it.
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible = true;

            //Make .bmp format default
            imageFormatList.SelectedIndex = 0;

            //Make count output default
            outputFormatCombo.SelectedIndex = 0;

            startHiddenCheckBox.Checked = readRegistry();
        }
Ejemplo n.º 9
0
        public SysTrayApp()
        {
            // Create a simple tray menu with only one item.

            trayMenu = new ContextMenu();

            trayMenu.MenuItems.Add("Sync Claims!",claims.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Registration!",registration.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Programme!", programme.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Programme Tiering!", progTiering.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Product!", product.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Product Tiering!", prodTiering.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Business Partner!", bp.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Search Functions!", searchFunctions.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Admin Center!", adminCenter.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Admin Amend!", adminAmend.CopyToDropbox);
            trayMenu.MenuItems.Add("Sync Admin Functions!", adminFunctions.CopyToDropbox);
            trayMenu.MenuItems.Add("-");
            trayMenu.MenuItems.Add("Exit", OnExit);

            // Create a tray icon. In this example we use a
            // standard system icon for simplicity, but you
            // can of course use your own custom icon too.

            trayIcon = new NotifyIcon();
            trayIcon.Text = "MyTrayApp";
            trayIcon.Icon = new Icon(SystemIcons.Asterisk, 40, 40);

            // Add menu to tray icon and show it.
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible = true;
        }
Ejemplo n.º 10
0
        public SysTrayContext()
        {
            container = new System.ComponentModel.Container();

              notifyIcon = new NotifyIcon(this.container);
              notifyIcon.Icon = forever.icon;

              notifyIcon.Text = "Forever";
              notifyIcon.Visible = true;

              //Instantiate the context menu and items
              contextMenu = new ContextMenuStrip();
              menuItemExit = new ToolStripMenuItem();

              //Attach the menu to the notify icon
              notifyIcon.ContextMenuStrip = contextMenu;

              menuItemExit.Text = "Exit";
              menuItemExit.Click += new EventHandler(menuItemExit_Click);
              contextMenu.Items.Add(menuItemExit);

              timer = new Timer(this.container);
              timer.Interval = 1000;
              timer.Tick += new EventHandler(timer_Tick);
              timer.Start();
        }
Ejemplo n.º 11
0
        public SysTrayMenu()
        {
            InitializeComponent();

            this.ClientSize = new System.Drawing.Size(FORM_WIDTH, Screen.PrimaryScreen.WorkingArea.Height);
            this.LostFocus += (object sender, EventArgs e) => MoveOutScreen();

            MoveOutScreen();

            trayMenu = new ContextMenu();
            trayMenu.MenuItems.Add("Exit", OnExit);
            trayMenu.MenuItems.Add("Show", OnShow);

            trayIcon = new NotifyIcon();
            trayIcon.Text = "eClipx";
            trayIcon.Icon = new Icon(SystemIcons.Application, 40, 40);

            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible = true;

            KeyboardHook.CallWhen(true, true, Keys.X, GlobalHookKeyPress);

            Common.MyHandle = Handle;
            CurrentApp.StartWatcher();

            clipboardItems = new MruList<int, ClipBoardElement>(CACHE_SIZE);
            controlItems = new List<ItemControl>(CACHE_SIZE);

            nextClipboardViewer = (IntPtr)User32.SetClipboardViewer((int)this.Handle);
        }
        /// <summary>
        /// Constructor initializes necessary variables and reads in saved constraints from text file.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            string fileName = @"Stored_Constraints.txt";
            Debug.WriteLine(DateTime.Now.ToString());
            filePath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), fileName);
            dateTimesForConstraints = new Dictionary<string, string>();

            backgroundListener = new SpeechRecognizer();
            constraints = new List<string>();
            BLResultGenerated = new TypedEventHandler<SpeechContinuousRecognitionSession, SpeechContinuousRecognitionResultGeneratedEventArgs>(blResultGenerated);
            backgroundListener.ContinuousRecognitionSession.ResultGenerated += BLResultGenerated;

            constraints = readInConstraintsFromFile();
            currentlyStoredConstraints = constraints.ToList();
            updateConstraintsWindow(constraints);

            this.Closing += OnAppClosing;

            var waitOn = loadOnStart();
            while (waitOn.Status != AsyncStatus.Completed) { }
            var ff = backgroundListener.ContinuousRecognitionSession.StartAsync();

            notifyIcon = new NotifyIcon();
            notifyIcon.Icon = new System.Drawing.Icon("trayImage.ico");
            notifyIcon.Visible = true;
            notifyIcon.DoubleClick +=
                delegate (object sender, EventArgs args)
                {
                    this.Show();
                    this.WindowState = WindowState.Normal;
                };
        }
 private MainForm()
 {
     InitializeComponent();
     Logger.logWindow = new LoggerForm();
     OpenMassSenderDBDataSet.getInstance();
     notification = this.notifyIcon1;
 }
Ejemplo n.º 14
0
        public NotificationIcon()
        {
            try {
                this.InitializePerformanceCounters();
                this.InitializePoints();
                this.InitializeFont();
                this.InitializeBitmap();
                this.InitializeGraphics();
                this.InitializeTimer();

                notifyIconCpu = new NotifyIcon();
                notifyIconRam = new NotifyIcon();

                Icon iconCpu = this.DrawIconCpu();
                Icon iconRam = this.DrawIconRam();
                notifyIconCpu.Icon = iconCpu;
                notifyIconRam.Icon = iconRam;
                iconCpu.Dispose();
                iconRam.Dispose();

                String text = this.DrawText();
                notifyIconCpu.Text = text;
                notifyIconRam.Text = text;

                notifyIconCpu.ContextMenu = this.InitializeMenu();
                notifyIconRam.ContextMenu = this.InitializeMenu();
                notifyIconCpu.Visible = true;
                notifyIconRam.Visible = true;
            } catch (Exception exception) {
                //MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
Ejemplo n.º 15
0
        public ApplicationContext()
        {
            if (Properties.Settings.Default.CallUpgrade)
              {
            Properties.Settings.Default.Upgrade();
            Properties.Settings.Default.CallUpgrade = false;
            Properties.Settings.Default.Save();
              }

              _components = new System.ComponentModel.Container();
              _notifyIcon = new NotifyIcon(_components)
              {
            ContextMenuStrip = new ContextMenuStrip(),
            Visible = true
              };
              _notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Settings", null, new EventHandler(MenuSettingsItem_Click)));
              _notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Exit", null, new EventHandler(MenuExitItem_Click)));

              _buddies = new Buddies();

              _housekeepingTimer = new System.Windows.Forms.Timer();
              _housekeepingTimer.Interval = 5000;
              _housekeepingTimer.Tick += HousekeepingTimer_Tick;
              HousekeepingTimer_Tick(null, null);     // tick anyway enables timer when finished

              _trackerStatus = TrackerStatus.OK;

              if (trackersConfigured())
              {
            _trackerStatus = TrackerStatus.UNKNOWN;
            UpdateTrackerSetting();
              }

              _viewModel = new ViewModel(_buddies);
        }
Ejemplo n.º 16
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="NotifyIconController" /> class.
        /// </summary>
        /// <param name="application">The application.</param>
        public NotifyIconController(GacApplication application)
        {
            _application = application;
            _notifyIcon = new NotifyIcon();
            var contextMenu = new ContextMenuStrip();
            contextMenu.Items.AddRange(
                new ToolStripItem[]
                {
                    new ToolStripMenuItem(Resources.NotifyIconController_NotifyIconController_About, null, (s, e) => ShowAbout()),
                    new ToolStripSeparator(),
                    new ToolStripMenuItem(Resources.NotifyIconController_NotifyIconController_Configuration, null,
                        (s, e) => ShowMainForm()),
                    new ToolStripMenuItem(Resources.NotifyIconController_NotifyIconController_Exit, null,
                        (s, e) => Close())
                }
                );

            _notifyIcon.ContextMenuStrip = contextMenu;
            _notifyIcon.Icon = Resources.icon_16;
            _notifyIcon.Text = Resources.AppName;

            _notifyIcon.DoubleClick += delegate { ShowMainForm(); };

            if (!application.IsCommandLineDriven && application.Tasks.Count == 0)
            {
                ShowMainForm();
            }
        }
Ejemplo n.º 17
0
Archivo: MainForm.cs Proyecto: akx/lauo
        public MainForm()
        {
            InitializeComponent();
            DoubleBuffered = true;

            trayIcon = new NotifyIcon {Icon = Icon, Text = "Lauo", Visible = true};
            trayIcon.Click += TrayIconOnClick;

            try {
                Settings.Instance.LoadConfiguration();
            } catch(Exception exc) {
                if(MessageBox.Show("Lauo could not read its configuration file. The problem looks like this:\n" + exc.Message + "\n\nWould you like to exit now to fix this by hand?\nNot exiting means your configuration will be overwritten by defaults.", "Oops!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
                    Environment.Exit(1);
                    return;
                }
            }
            LaunchDatabase.Instance.DatabaseUpdated += DbOnDatabaseUpdated;

            showHotkey = Settings.Instance.GetConfiguredHotkey();
            showHotkey.Pressed += ((sender, args) => ShowInteractive());

            /*foreach(var ent in LaunchDatabase.Instance.GetRecent()) {
                Debug.Print("{0}", ent);
            }
             */

            Shown += OnShown;
            Closed += OnClosed;
        }
Ejemplo n.º 18
0
 public ProcessIcon(string name)
 {
     ni = new NotifyIcon();
     ni.ContextMenuStrip = new ContextMenuBuilder().GetDefaultMenu();
     ni.Text = name;
     ni.Icon = Properties.Resources.icon;
 }
Ejemplo n.º 19
0
        public Form1()
        {
            this.components = new Container();
            this.contextMenu1 = new ContextMenu();
            this.menuItem1 = new MenuItem();
            this.notifyIcon = new NotifyIcon(this.components);

            this.contextMenu1.MenuItems.AddRange(
                        new MenuItem[] { this.menuItem1 });

            this.menuItem1.Index = 0;
            this.menuItem1.Text = "E&xit";
            menuItem1.Click += new EventHandler(menuItem1_Click);

            this.notifyIcon = new NotifyIcon(this.components);

            notifyIcon.Icon = G930Helper.Properties.Resources.logihelp;

            notifyIcon.ContextMenu = this.contextMenu1;

            notifyIcon.Text = "Logitech G930 Helper";

            notifyIcon.Click += new EventHandler(notifyIcon_Click);
            InitializeComponent();
            TimeoutToHide = TimeSpan.FromMinutes(5);
            System.Timers.Timer aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(timer1_Tick);
            aTimer.Interval = 5000;
            aTimer.Enabled = true;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// A media player that is controlled from a notify icon
        /// using the mouse. Takes control of the notifyicon icon,
        /// tooltip and balloon to display status.
        /// </summary>
        /// <param name="icon">
        /// The notify icon that controls playback.
        /// </param>
        public Player(NotifyIcon icon)
        {
            notifyIcon = icon;
            notifyIcon.MouseClick += OnMouseClick;

            player = new MediaPlayer();
            player.BufferingStarted += OnBufferingStarted;
            player.BufferingEnded += OnBufferingEnded;
            player.MediaEnded += OnMediaEnded;
            player.MediaFailed += OnMediaFailed;

            source = null;
            isIdle = true;

            idleIcon = Utils.ResourceAsIcon("GaGa.Resources.idle.ico");
            playingIcon = Utils.ResourceAsIcon("GaGa.Resources.playing.ico");
            playingMutedIcon = Utils.ResourceAsIcon("GaGa.Resources.playing-muted.ico");

            bufferingIcons = new Icon[] {
                Utils.ResourceAsIcon("GaGa.Resources.buffering1.ico"),
                Utils.ResourceAsIcon("GaGa.Resources.buffering2.ico"),
                Utils.ResourceAsIcon("GaGa.Resources.buffering3.ico"),
                Utils.ResourceAsIcon("GaGa.Resources.buffering4.ico"),
            };

            bufferingIconTimer = new DispatcherTimer();
            bufferingIconTimer.Interval = TimeSpan.FromMilliseconds(300);
            bufferingIconTimer.Tick += bufferingIconTimer_Tick;

            currentBufferingIcon = 0;

            UpdateIcon();
        }
Ejemplo n.º 21
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string response = network.HttpPost("http://www.status3gaming.com/gmtool/", "user="******"&pass="******"0"){
                MessageBox.Show("Failed Login", "Response", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else if (Regex.IsMatch(response, "[0-9A-Fa-f]{40}"))
            {
                Program.SetHash(response);
                MessageBox.Show("Successfully Logged In", "Response", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.Visible = false;

                //Create Context Menu for system tray.
                sysTrayMenu = new ContextMenu();
                sysTrayMenu.MenuItems.Add("Check for new tickets...", OnRefresh);
                sysTrayMenu.MenuItems.Add("Quit", OnExit);

                sysTrayIcon = new NotifyIcon();
                sysTrayIcon.Text = "GM Tool";
                sysTrayIcon.Icon = Properties.Resources.Tray;

                // Add menu to tray icon and show it.
                sysTrayIcon.ContextMenu = sysTrayMenu;
                sysTrayIcon.Visible = true;
                sysTrayIcon.BalloonTipClicked += new EventHandler(sysTrayIcon_BaloonTipClicked);
                sysTrayIcon.ShowBalloonTip(5000, "GM Tool", "Tray Monitor Active", ToolTipIcon.None);

                timer.Start();
            }
        }
Ejemplo n.º 22
0
        public MainEnvironment()
        {
            if (Properties.Settings.Default.destinationFolder == "")
            {
                Properties.Settings.Default.destinationFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            }

            notifyIcon = new NotifyIcon()
            {
                Icon = new Icon(System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/Resources/notifyicon.ico")).Stream),
                Text = "Screenshot",

                ContextMenu = new ContextMenu(new MenuItem[]
                {
                    new MenuItem("Make Screenshot", contextMenu_makeScreenshotButton_Click),
                    new MenuItem("Settings", contextMenu_settingsButton_Click),
                    new MenuItem("-"),
                    new MenuItem("Exit", contextMenu_exitButton_Click),
                }),

                Visible = true
            };

            this.notifyIcon.MouseClick += notifyIcon_MouseClick;

            kbHook.KeyDown += kbHook_KeyDown;
            kbHook.KeyUp += kbHook_KeyUp;

            System.Windows.Application.Current.Exit += Application_Exit;
        }
        internal ObedienceContext()
        {
            //Instantiate the component Module to hold everything
            _components = new System.ComponentModel.Container();
            Trace.Listeners.Add(new TextWriterTraceListener("C:\\temp\\Obedience.log"));
            
            //Instantiate the NotifyIcon attaching it to the components container and 
            //provide it an icon, note, you can imbed this resource 
            _notifyIcon = new NotifyIcon(_components);
            _notifyIcon.Icon = Resources.AppIcon;
            _notifyIcon.Text = "Obedience";
            _notifyIcon.Visible = true;

            //Instantiate the context menu and items
            var contextMenu = new ContextMenuStrip();
            var displayForm = new ToolStripMenuItem();
            var exitApplication = new ToolStripMenuItem();

            //Attach the menu to the notify icon
            _notifyIcon.ContextMenuStrip = contextMenu;

            //Setup the items and add them to the menu strip, adding handlers to be created later
            displayForm.Text = "Do something";
            displayForm.Click += mDisplayForm_Click;
            contextMenu.Items.Add(displayForm);

            exitApplication.Text = "Exit";
            exitApplication.Click += mExitApplication_Click;
            contextMenu.Items.Add(exitApplication);
            Trace.WriteLine("Obedience started");
            scanner = new AcdController(new IPEndPoint(new IPAddress(new byte[] {10, 0, 3, 220}), 5003));
            //scanner.Reboot();
            Trace.AutoFlush = true;
            scanner.ConnectedChanged += new ConnectedChangedEventHandler(scanner_ConnectedChanged);
        }
Ejemplo n.º 24
0
        public MocsForm()
        {
            InitializeComponent();

            _configuration = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);

            _notifyIcon = new NotifyIcon();
            _notifyIcon.Text = "Mocs Notification";
            _notifyIcon.Visible = true;
            _notifyIcon.Icon = new Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream("MocsClient.sync.ico"));
            _notifyIcon.DoubleClick += new EventHandler(_notifyIcon_DoubleClick);

            // Old school balloon tip
            //_notifyIcon.BalloonTipClicked += new EventHandler(_notifyIcon_BalloonTipClicked);

            BuildContextMenu();
            _notifyIcon.ContextMenu = _contextMenu;

            _messageInterceptor = new MessageInterceptor();
            _messageInterceptor.Initialize();

            dataGridViewNotification.MouseWheel += new MouseEventHandler(dataGridViewNotification_MouseWheel);
            dataGridViewNotification.KeyDown += new KeyEventHandler(dataGridViewNotification_KeyDown);
            dataGridViewNotification.KeyUp += new KeyEventHandler(dataGridViewNotification_KeyUp);
        }
		/// <summary>
		/// 构造 NotifyIconHelper 的新实例。
		/// </summary>
		/// <param name="mainForm">应用程序主窗体。</param>
		/// <param name="notHandleClosingEvent">是否不让 NotifyIconHelper 处理主窗体的 FormClosing 事件。
		/// <remarks>
		/// 缺省情况下此参数应为 False,即 NotifyIconHelper 总是通过处理主窗体的 FormClosing 事件达到让主窗体在关闭后
		/// 驻留系统托盘区的目的。但特殊情况下,应用程序可能会自己处理主窗体的的 FormClosing 事件,此时应设置此属性为 True。
		/// </remarks>
		/// </param>
		/// <param name="showPromptWhenClosing">是否在窗体关闭时给用户以提示,仅当 NotHandleClosingEvent = False 时有效。</param>
		public NotifyIconHelper( Form mainForm, bool notHandleClosingEvent, bool showPromptWhenClosing )
		{
			_mainForm = mainForm;
			_showPromptWhenClosing = showPromptWhenClosing;

			_imgLst = new ImageList();
			_imgLst.Images.Add( _mainForm.Icon );

			Image img = Image.FromHbitmap( _mainForm.Icon.ToBitmap().GetHbitmap() );

			_contextMenu = new ContextMenuStrip();

			_contextMenu.Items.Add( new ToolStripMenuItem( Resources.MenuShowMainForm, img, OnShowMainForm ) );
			_contextMenu.Items.Add( new ToolStripSeparator() );
			_contextMenu.Items.Add( new ToolStripMenuItem( Resources.MenuExit, null, OnExitApp ) );

			_notifyIcon = new NotifyIcon();
			_notifyIcon.Icon = GetAppIcon();
			_notifyIcon.Text = _mainForm.Text;
			_notifyIcon.Visible = true;
			_notifyIcon.ContextMenuStrip = _contextMenu;
			_notifyIcon.MouseDown += _notifyIcon_MouseDown;

			_mainForm.FormClosed += _mainForm_FormClosed;

			if( notHandleClosingEvent == false )
				_mainForm.FormClosing += new FormClosingEventHandler( _mainForm_FormClosing );
		}
Ejemplo n.º 26
0
        public Main()
        {
            InitializeComponent();

            //initialize tray icon
            notifyIcon = new NotifyIcon();
            Stream iconStream = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/clientWPF;component/sync.ico")).Stream;
            notifyIcon.Icon = new System.Drawing.Icon(iconStream);
            notifyIconMenu = new System.Windows.Forms.ContextMenu();
            System.Windows.Forms.MenuItem mnuItemSyncNow = new System.Windows.Forms.MenuItem();
            System.Windows.Forms.MenuItem mnuItemShow = new System.Windows.Forms.MenuItem();
            mnuItemShow.Text = "Show";
            mnuItemShow.Click += new System.EventHandler(notifyIcon_Click);
            notifyIconMenu.MenuItems.Add(mnuItemShow);
            mnuItemSyncNow.Text = "SyncNow";
            mnuItemSyncNow.Click += new System.EventHandler(syncMenuItem);
            notifyIconMenu.MenuItems.Add(mnuItemSyncNow);
            notifyIcon.Text = "SyncClient";
            notifyIcon.ContextMenu = notifyIconMenu;
            notifyIcon.BalloonTipTitle = "App minimized to tray";
            notifyIcon.BalloonTipText = "Sync sill running.";

            // Settings
            connectionSettings = new ConnectionSettings();
            tAddress.Text = connectionSettings.readSetting("connection", "address");
            tPort.Text = connectionSettings.readSetting("connection", "port");
            tDirectory.Text = connectionSettings.readSetting("account", "directory");
            tTimeout.Text = connectionSettings.readSetting("connection", "syncTime");
        }
Ejemplo n.º 27
0
        public void Initialize()
        {
            m_Notify = new NotifyIcon();
            m_Notify.Visible = true;
            m_Notify.Icon = SystemIcons.Application;
            m_Notify.ContextMenu = new ContextMenu(new MenuItem[] { new MenuItem("Exit", tsmiQuit_Click) });
            m_Notify.MouseDoubleClick += NotifyIcon_MouseDoubleClick;

            try
            {
                string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), SETTINGS_FOLDER_NAME);
                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                    WriteSettings(new ConnectionSettings());
                }

                m_Settings = LoadSettings();
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (JsonSerializationException ex)
            {
                MessageBox.Show("Error interpreting settings. Clearing.");
                WriteSettings(new ConnectionSettings());
                m_Settings = new ConnectionSettings();
            }

            btnStart.Enabled = !(m_Settings == null || !m_Settings.IsValid);
            btnStop.Enabled = false;
        }
Ejemplo n.º 28
0
        public Main()
        {
            InitializeComponent();
            string headerText = string.Format("InfiniPad v{0}", Globals.getVersion());
            this.Icon = Properties.Resources.icon;
            this.Text = headerText;

            hk = new Hotkeys();
            
            nfi = new NotifyIcon();
            nfi.Icon = Properties.Resources.icon;
            nfi.Visible = true;
            nfi.Text = headerText;
            nfi.MouseClick += nfiClicked;

            ContextMenu ctm = new ContextMenu();
            ctm.MenuItems.Add("Exit", new EventHandler(nfiExit));

            nfi.ContextMenu = ctm;

            hk.ReapplyHotkeys();
            Globals.CreateMoveDir();

            #region movefile
#if !DEBUG
                    Globals.moveFile(Globals.MoveToDir + "InfiniPad.exe");
#endif
            #endregion
            


        }
Ejemplo n.º 29
0
        private void Install()
        {
            _contextMenu = new ContextMenuStrip();
            _contextMenu.Items.AddRange(new ToolStripItem[] {
                new ToolStripMenuItem(Strings.MenuOpen, Resources.icon, TaskIconOpen_click) {
                    ToolTipText = Strings.MenuOpenTT,
                },
                new ToolStripMenuItem(Strings.MenuWindows, Resources.list){
                    DropDown = Form.MenuWindows,
                    ToolTipText = Strings.MenuWindowsTT
                },
                new ToolStripMenuItem(Strings.MenuReset, null, TaskIconReset_click){
                    ToolTipText = Strings.MenuResetTT
                },
                new ToolStripMenuItem(Strings.MenuClose, Resources.close_new, TaskIconExit_click){
                    ToolTipText = Strings.MenuCloseTT
                }
            });
            Asztal.Szótár.NativeToolStripRenderer.SetToolStripRenderer(_contextMenu);

            _taskIcon = new NotifyIcon {
                Text = Strings.ApplicationName,
                Icon = Resources.new_flat_icon,
                Visible = true,
                ContextMenuStrip = _contextMenu
            };
            _taskIcon.DoubleClick += new EventHandler(TaskIcon_doubleclick);
        }
Ejemplo n.º 30
0
 private void OnClosed(object sender, System.EventArgs e)
 {
     try
     {
         if (_notifyIcon != null)
         {
             _notifyIcon.Visible = false;
             _notifyIcon.Dispose();
             _notifyIcon = null;
         }
     }
     catch (Exception)
     {
     }
 }
Ejemplo n.º 31
0
 private void InitializeComponent()
 {
     if (Main.frmPrincipal.myNotify != null)
     {
         TrayIcon = Main.frmPrincipal.myNotify;
     }
     else
     {
         TrayIcon      = new System.Windows.Forms.NotifyIcon();
         TrayIcon.Text = "Cartão Igreja Notificação";
         TrayIcon.Icon = CamadaUI.Properties.Resources.program_icon;
         Main.frmPrincipal.myNotify   = TrayIcon;
         Application.ApplicationExit += new EventHandler(this.OnApplicationExit);
     }
 }
Ejemplo n.º 32
0
        private void InitializeTrayIcon()
        {
            InitializeNotifyMenu();
            _niNotifyIcon                  = new System.Windows.Forms.NotifyIcon();
            _niNotifyIcon.Text             = "Shary";
            _niNotifyIcon.BalloonTipTitle  = "Shary";
            _niNotifyIcon.Visible          = true;
            _niNotifyIcon.ContextMenuStrip = _mnuStripMenu;
            _niNotifyIcon.Icon             = UI.Properties.Resources.Icon;

            Exit += (s, e) =>
            {
                HideNotifyIcon();
            };
        }
Ejemplo n.º 33
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            MainWindow          = new MainWindow();
            MainWindow.Closing += MainWindow_Closing;

            _notifyIcon              = new winForms.NotifyIcon();
            _notifyIcon.DoubleClick += (s, args) => ShowMainWindow();
            _notifyIcon.Icon         = SystemIcons.Information;
            _notifyIcon.Visible      = true;
            CreateContextMenu();

            MainWindow.Show();
        }
Ejemplo n.º 34
0
        //ilk form load edilirken 1 kez girer buraya
        private void SetUpTrayIcon()
        {
            systemTrayIcon = new System.Windows.Forms.NotifyIcon();
            systemTrayIcon.BalloonTipText  = "Click this icon to restore.";
            systemTrayIcon.BalloonTipTitle = "Your app minimized to system tray";
            systemTrayIcon.Text            = "Ahmet's IP History Keeper";

            //System.Reflection.Assembly myTempAss = System.Reflection.Assembly.GetExecutingAssembly();
            //string[] names = this.GetType().Assembly.GetManifestResourceNames();

            systemTrayIcon.Icon = new System.Drawing.Icon(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ahmetsIpHistoryKeeper.icon.ico"));

            systemTrayIcon.Click  += new EventHandler(HandlerToMaximiseOnClick);
            systemTrayIcon.Visible = false;
        }
Ejemplo n.º 35
0
        private void OnInitialized(object sender, EventArgs e)
        {
            // Initialize Registry Manager
            _registryManager = new RegistryManager();

            _iconHandles = new Dictionary <string, Drawing.Icon>();
            _iconHandles.Add("QuickLaunch", new Drawing.Icon(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"OpenBots.ico")));
            _notifyIcon              = new SystemForms.NotifyIcon();
            _notifyIcon.Click       += notifyIcon_Click;
            _notifyIcon.DoubleClick += notifyIcon_DoubleClick;
            _notifyIcon.Icon         = _iconHandles["QuickLaunch"];
            StateChanged            += OnStateChanged;
            Closing += OnClosing;
            Closed  += OnClosed;
        }
Ejemplo n.º 36
0
        public static async Task Toast(string title, string content)
        {
            // https://stackoverflow.com/a/34956412
            var notification = new System.Windows.Forms.NotifyIcon()
            {
                Visible         = false,
                Icon            = null,
                BalloonTipTitle = title,
                BalloonTipText  = content,
            };

            await Task.Run(() => notification.ShowBalloonTip(5000));

            notification.Dispose();
        }
Ejemplo n.º 37
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            MainWindow          = new MainWindow();
            MainWindow.Closing += MainWindow_Closing;



            _notifyIcon              = new System.Windows.Forms.NotifyIcon();
            _notifyIcon.DoubleClick += (s, args) => ShowMainWindow();
            _notifyIcon.Icon         = DropMeter.Properties.Resources.Icon;
            _notifyIcon.Visible      = true;
            widgetLoader.LoadWidgets();
            CreateContextMenu();
        }
Ejemplo n.º 38
0
        private void Initialize()
        {
            _tray = new Forms.NotifyIcon();

            _tray.MouseClick += OnTrayClick;

            _tray.Visible = true;
            _watcherControl.WatcherStatusChanged += ChangeTray;

            _tray.ContextMenuStrip = new Forms.ContextMenuStrip();
            _tray.ContextMenuStrip.Items.Add("Tray:Options:Show".Translate()).Click  += OnTrayClickShow;
            _tray.ContextMenuStrip.Items.Add("Tray:Options:Close".Translate()).Click += OnTrayClickExit;

            ChangeTray(null, new WatcherStatusEventArgs(false));
        }
Ejemplo n.º 39
0
        public MainWindow()
        {
            InitializeComponent();

            TextBox_IpAddress.Text = locIp;

            ni = new System.Windows.Forms.NotifyIcon();

            ni.Icon         = iconDisconnected;
            ni.Visible      = true;
            ni.DoubleClick += new System.EventHandler(this.NotifyIcon1DoubleClick);

            Start_Button.IsEnabled = true;
            Close_Button.IsEnabled = false;
        }
Ejemplo n.º 40
0
        private void CreateNotifyIcon()
        {
            notifyIcon = new Forms.NotifyIcon()
            {
                BalloonTipText  = TiwaResources.BalloonTipText,
                BalloonTipTitle = TiwaResources.ApplicationName,
                Text            = TiwaResources.ApplicationName,
                ContextMenu     = new Forms.ContextMenu(),
                Icon            = LoadIcon()
            };

            Forms.MenuItem closeMenu = notifyIcon.ContextMenu.MenuItems.Add("Close");
            closeMenu.Click  += (sender, e) => this.Shutdown();
            notifyIcon.Click += OnNotifyIconClicked;
        }
Ejemplo n.º 41
0
        private void CreateTrayMenu()
        {
            var components = new System.ComponentModel.Container();

            var contextMenu      = new System.Windows.Forms.ContextMenu();
            var menuItemOpen     = new System.Windows.Forms.MenuItem();
            var menuItemSettings = new System.Windows.Forms.MenuItem();
            var menuItemSeparete = new Separator();
            var menuItemExit     = new System.Windows.Forms.MenuItem();

            // Initialize menuItem1
            menuItemOpen.Index  = 0;
            menuItemOpen.Text   = "O&pen";
            menuItemOpen.Click += new System.EventHandler(this.notifyIcon_Open);

            // todo
            //menuItemSettings.Index = 1;
            //menuItemSettings.Text = "S&ettings";
            //menuItemSettings.Click += new System.EventHandler(this.notifyIcon_Settings);

            menuItemExit.Index  = 3;
            menuItemExit.Text   = "E&xit";
            menuItemExit.Click += new System.EventHandler(this.notifyIcon_Exit);

            // Initialize contextMenu
            contextMenu.MenuItems.Add(menuItemOpen);
            contextMenu.MenuItems.Add("-");
            contextMenu.MenuItems.Add(menuItemExit);

            // Create the NotifyIcon.
            notifyIcon = new System.Windows.Forms.NotifyIcon(components);

            // The Icon property sets the icon that will appear
            // in the systray for this application.
            notifyIcon.Icon = Properties.Resources.icon;

            // The ContextMenu property sets the menu that will
            // appear when the systray icon is right clicked.
            notifyIcon.ContextMenu = contextMenu;

            // The Text property sets the text that will be displayed,
            // in a tooltip, when the mouse hovers over the systray icon.
            notifyIcon.Text    = "Password cards system";
            notifyIcon.Visible = true;

            // Handle the DoubleClick event to activate the form.
            notifyIcon.DoubleClick += new System.EventHandler(this.notifyIcon_Open);
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(AnimatedWindowForm));
            this.notifyIcon    = new System.Windows.Forms.NotifyIcon(this.components);
            this.exitButton    = new System.Windows.Forms.Button();
            this.minimizeLabel = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // notifyIcon
            //
            this.notifyIcon.Icon    = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon")));
            this.notifyIcon.Text    = "";
            this.notifyIcon.Visible = true;

            this.notifyIcon.DoubleClick += new System.EventHandler(this.notifyIcon_DoubleClick);
            //
            // exitButton
            //
            this.exitButton.Location = new System.Drawing.Point(136, 136);
            this.exitButton.Name     = "exitButton";
            this.exitButton.Size     = new System.Drawing.Size(48, 23);
            this.exitButton.TabIndex = 0;
            this.exitButton.Text     = "Exit";
            this.exitButton.Click   += new System.EventHandler(this.exitButton_Click);
            //
            // minimizeLabel
            //
            this.minimizeLabel.BackColor   = System.Drawing.Color.White;
            this.minimizeLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.minimizeLabel.Location    = new System.Drawing.Point(68, 32);
            this.minimizeLabel.Name        = "minimizeLabel";
            this.minimizeLabel.Size        = new System.Drawing.Size(184, 88);
            this.minimizeLabel.TabIndex    = 1;
            this.minimizeLabel.Text        = "This window minimizes to the system tray when closed.";
            //
            // AnimatedWindowForm
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize        = new System.Drawing.Size(320, 190);
            this.Controls.Add(this.minimizeLabel);
            this.Controls.Add(this.exitButton);
            this.Icon  = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name  = "AnimatedWindowForm";
            this.Text  = "AnimatedWindow";
            this.Load += new System.EventHandler(this.AnimatedWindowForm_Load);
            this.ResumeLayout(false);
        }
Ejemplo n.º 43
0
        public MainForm()
        {
            this.components   = new System.ComponentModel.Container();
            this.contextMenu1 = new System.Windows.Forms.ContextMenu();
            this.menuItem1    = new System.Windows.Forms.MenuItem();
            this.menuItem2    = new System.Windows.Forms.MenuItem();

            // Initialize contextMenu1
            this.contextMenu1.MenuItems.AddRange(
                new System.Windows.Forms.MenuItem[] { this.menuItem1, this.menuItem2 });

            this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState     = FormWindowState.Minimized;
            this.Location        = new System.Drawing.Point(-1000, -1000);
            this.Size            = new System.Drawing.Size(0, 0);
            this.Visible         = false;

            // Initialize menuItem1
            this.menuItem1.Index  = 0;
            this.menuItem1.Text   = "E&xit";
            this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
            this.menuItem2.Index  = 1;
            this.menuItem2.Text   = "Say Something";
            this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);

            // Set up how the form should be displayed.
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Text       = "Notify Icon Example";

            // Create the NotifyIcon.
            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);

            // The Icon property sets the icon that will appear
            // in the systray for this application.
            notifyIcon1.Icon = new Icon("appicon.ico");

            // The ContextMenu property sets the menu that will
            // appear when the systray icon is right clicked.
            notifyIcon1.ContextMenu = this.contextMenu1;

            // The Text property sets the text that will be displayed,
            // in a tooltip, when the mouse hovers over the systray icon.
            notifyIcon1.Text    = "Form1 (NotifyIcon example)";
            notifyIcon1.Visible = true;

            // Handle the DoubleClick event to activate the form.
            notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
        }
Ejemplo n.º 44
0
        public Form1()
        {
            InitializeComponent();
            //指定使用的容器
            this.components  = new System.ComponentModel.Container();
            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
            //建立NotifyIcon
            this.notifyIcon1.Icon = new Icon("mail.ico");
            this.notifyIcon1.Text = "HookExample";
            //點Icon兩下執行此動作
            this.notifyIcon1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDoubleClick);

            this.WindowState   = FormWindowState.Minimized;
            this.ShowInTaskbar = false;
            SetVisibleCore(false);
        }
Ejemplo n.º 45
0
        public static Rect GetRectangle(this Forms.NotifyIcon notifyIcon)
        {
            Interop.NOTIFYICONIDENTIFIER identifier;
            if (TryGetNotifyIconIdentifier(notifyIcon, out identifier))
            {
                Interop.RECT iconLocation;
                var          result = Interop.Shell_NotifyIconGetRect(ref identifier, out iconLocation);

                if ((result == 0) || (result == 1))
                {
                    return(iconLocation);
                }
            }

            return(Rect.Empty);
        }
 private void InitializeFormState()
 {
     this.notifyIcon1              = new System.Windows.Forms.NotifyIcon();
     this.notifyIcon1.Icon         = SeatClientLeave.Properties.Resources.标1;
     this.notifyIcon1.Text         = "座位管理系统程序";
     menuItem1.Click              += new EventHandler(menuItem_Click);
     menuItem2.Click              += new EventHandler(menuItem2_Click);
     menuItem3.Click              += new EventHandler(menuItem3_Click);
     this.notifyIcon1.DoubleClick += new EventHandler(notifyIcon1_DoubleClick);
     this.notifyIcon1.Visible      = true;
     this.notifyIcon1.ShowBalloonTip(5000, "离开终端", "程序已启动", ToolTipIcon.Info);
     if (SeatClientLeave.Code.LeaveClientSetting.WindowState != Code.FormWindowState.Minimized)
     {
         menuItem3.PerformClick();
     }
 }
Ejemplo n.º 47
0
 //public static PrincipalContext pc = new PrincipalContext(ContextType.Machine, null);
 public Start()
 {
     InitializeComponent();
     _trayIcon              = new System.Windows.Forms.NotifyIcon();
     _trayIcon.Icon         = new System.Drawing.Icon("Resources/Icon.ico");
     _trayIcon.Visible      = true;
     _trayIcon.DoubleClick += delegate(object sender, EventArgs args)
     {
         this.Show();
         this.WindowState = WindowState.Normal;
     };
     _trayIcon.Click += delegate(object sender, EventArgs args)
     {
         this.Hide();
     };
 }
Ejemplo n.º 48
0
        private void icon()
        {
            this.notifyIcon = new WinForms.NotifyIcon();

            this.notifyIcon.BalloonTipText = "Hello, 文件监视器";                     //设置程序启动时显示的文本

            this.notifyIcon.Text = "文件监视器";                                      //最小化到托盘时,鼠标点击时显示的文本

            this.notifyIcon.Icon = new System.Drawing.Icon("./res/icon-32.ico"); //程序图标

            this.notifyIcon.Visible = true;

            notifyIcon.MouseDoubleClick += notifier_MouseDown;

            this.notifyIcon.ShowBalloonTip(1000);
        }
Ejemplo n.º 49
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            notifyIcon        = new System.Windows.Forms.NotifyIcon();
            notifyIcon.Click += notifyIcon_Click;
            var mI = new System.Windows.Forms.MenuItem("Exit Infinitton WPF");

            mI.Click += MenuItem_OnClick;
            notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(new[] { mI });
            notifyIcon.Icon        = new System.Drawing.Icon("Icon16.ico");
            notifyIcon.Visible     = true;
            brightnessSlider.Value = Properties.Settings.Default.Brightness;
            controller             = new MainController(this);
            tbNewProcessAction.Items.Add(LaunchAction.ProcessRunningAction.NewProcess.ToString());
            tbNewProcessAction.Items.Add(LaunchAction.ProcessRunningAction.FocusOldProcess.ToString());
            tbNewProcessAction.Items.Add(LaunchAction.ProcessRunningAction.KillOldProcess.ToString());
        }
Ejemplo n.º 50
0
        private static void SetupNotifyIcon()
        {
            var notifyIcon = new System.Windows.Forms.NotifyIcon {
                Icon = new Icon("Icon.ico"), Visible = true
            };

            notifyIcon.ShowBalloonTip(1000, "Kollector", "Kollector is up and running", System.Windows.Forms.ToolTipIcon.Info);
            notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(new System.Windows.Forms.MenuItem[]
            {
                new System.Windows.Forms.MenuItem("Close", (sender, args) =>
                {
                    Application.Current.Shutdown();
                    notifyIcon.Dispose();
                })
            });
        }
Ejemplo n.º 51
0
        private void InitializeNotifyIcon()
        {
            this.notifyIcon = new Forms.NotifyIcon
            {
                Text    = this.Text,
                Icon    = FromImageSource(this.Icon),
                Visible = this.Visibility == Visibility.Visible
            };

            this.notifyIcon.MouseDown        += this.OnMouseDown;
            this.notifyIcon.MouseUp          += this.OnMouseUp;
            this.notifyIcon.MouseClick       += this.OnMouseClick;
            this.notifyIcon.MouseDoubleClick += this.OnMouseDoubleClick;

            this.InitializeNativeHooks();
        }
Ejemplo n.º 52
0
 /// <summary>
 /// GUI Init : mostly TrayIcon + Menu
 /// </summary>
 private void InitializeComponent()
 {
     //Tray Icon
     //Looking for explorer.exe process, if not skip TrayIcon to make the program work
     Process[] pExplorer = Process.GetProcessesByName("explorer");
     if (pExplorer.Length > 0)
     {
         _TrayIcon      = new NotifyIcon();
         _TrayIcon.Text = "DemulShooter";
         _TrayIcon.Icon = DemulShooter.Properties.Resources.DemulShooter_UnHooked_Icon;
         _TrayIconMenu  = new ContextMenu();
         _TrayIconMenu.MenuItems.Add("Exit", OnTrayExitSelected);
         _TrayIcon.ContextMenu = _TrayIconMenu;
         _TrayIcon.Visible     = true;
     }
 }
Ejemplo n.º 53
0
        private void showNotification(String status, double percentage)
        {
            var notification = new System.Windows.Forms.NotifyIcon()
            {
                Visible         = true,
                Icon            = System.Drawing.SystemIcons.Information,
                BalloonTipIcon  = System.Windows.Forms.ToolTipIcon.Info,
                BalloonTipTitle = "Zaki Battery Warning App",
                BalloonTipText  = $"Your battery percentage is {percentage}%\nPlease take suitable action for healthier battery life !!",
            };

            // Display for 20 seconds
            notification.ShowBalloonTip(20 * 1000);

            notification.Dispose();
        }
Ejemplo n.º 54
0
        internal NotifyIcon(UseContextMenuEvents useContextMenu)
        {
            _useContextMenu          = useContextMenu;
            _balloonTipTextByDefault = "Уведомление по умолчанию.";

            _notifyIcon = new WF.NotifyIcon()
            {
                BalloonTipIcon = WF.ToolTipIcon.Info,
                ContextMenu    = CreateContextMenu(),
                Icon           = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location)
            };
            _notifyIcon.DoubleClick       += ContextMenuItemStateNormal;
            _notifyIcon.BalloonTipClicked += _notifyIcon_BalloonTipClicked;

            SetBalloonTipTextDefault();
        }
Ejemplo n.º 55
0
        public MainWindow()
        {
            InitializeComponent();
            MyNotifyIcon = new System.Windows.Forms.NotifyIcon();
            //MyNotifyIcon.Icon = new System.Drawing.Icon(
            //                @"C:\Windows\winsxs\amd64_microsoft-windows-ie-internetexplorer_31bf3856ad364e35_11.2.9600.19230_none_11d06f2b2efabe51\bing.ico");

            MyNotifyIcon.Icon = new System.Drawing.Icon(
                @"C:\Users\310252036\source\repos\StockView\StockView\Resource\StockViewer.ico");
            MyNotifyIcon.MouseDoubleClick +=
                new System.Windows.Forms.MouseEventHandler
                    (MyNotifyIcon_MouseDoubleClick);
            this.StateChanged += Window_StateChanged;
            _viewModel         = new MainViewModel();
            DataContext        = _viewModel;
        }
Ejemplo n.º 56
0
        private void InitTrayIcon()
        {
            // NotifyToSystemTray:
            _notifyIcon = new System.Windows.Forms.NotifyIcon
            {
                BalloonTipText  = "The app has been minimized. Click the tray icon to show.",
                BalloonTipTitle = UserSettings.ProductNameWithVersion,
                Text            = UserSettings.ProductNameWithVersion,
                Icon            = Properties.Resources.CommunityBridge2
            };
            _notifyIcon.Click += NotifyIconClick;

            Closing          += OnClose;
            StateChanged     += OnStateChanged;
            IsVisibleChanged += OnIsVisibleChanged;
        }
        private void InitTrayIcon()
        {
            // NotifyToSystemTray:
            _notifyIcon = new System.Windows.Forms.NotifyIcon
            {
                BalloonTipText  = "The app has been minimized. Click the tray icon to show.",
                BalloonTipTitle = "Community Forums NNTP Bridge",
                Text            = "Community Forums NNTP Bridge",
                Icon            = Properties.Resources.CommunityForumsNNTPServer
            };
            _notifyIcon.Click += NotifyIconClick;

            Closing          += OnClose;
            StateChanged     += OnStateChanged;
            IsVisibleChanged += OnIsVisibleChanged;
        }
        private void EditBtn_Click(object sender, RoutedEventArgs e)
        {
            //Initalize the context menu strip

            contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip();
            //  contextMenuStrip1.Font=FontFamily.FamilyNam
            System.Windows.Forms.ToolStripMenuItem mI1 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI2 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI3 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI4 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI5 = new System.Windows.Forms.ToolStripMenuItem();
            System.Windows.Forms.ToolStripMenuItem mI6 = new System.Windows.Forms.ToolStripMenuItem();
            mI1.Text = "تیزی تصویر";
            mI2.Text = "وضوح";
            mI3.Text = "روشنایی";
            mI4.Text = "بازیابی تصویر اولیه";
            mI5.Text = "پیش نمایش";
            mI6.Text = "ذخیره";
            contextMenuStrip1.Items.Add(mI1);
            contextMenuStrip1.Items.Add(mI2);
            contextMenuStrip1.Items.Add(mI3);
            contextMenuStrip1.Items.Add(mI4);
            contextMenuStrip1.Items.Add(mI5);
            contextMenuStrip1.Items.Add(mI6);

            mI1.Click += new EventHandler(sharpenImageToolStripMenuItem_Click); //Add Click Handler
            mI2.Click += new EventHandler(contrastToolStripMenuItem_Click);     //Add Click Handler
            mI3.Click += new EventHandler(brightnessToolStripMenuItem_Click);   //Add Click Handler
            mI4.Click += new EventHandler(restoreImageToolStripMenuItem_Click); //Add Click Handler
            mI5.Click += new EventHandler(previewToolStripMenuItem_Click);      //Add Click Handler
            mI6.Click += new EventHandler(SaveImagetoolStripMenuItem_Click);    //Add Click Handler

            //Initalize Notify Icon

            m_notifyIcon = new System.Windows.Forms.NotifyIcon();

            m_notifyIcon.Text = "Application Title";

            //m_notifyIcon.Icon = new System.Drawing.Icon("Icon.ico");

            m_notifyIcon.ContextMenuStrip = contextMenuStrip1;  //Associate the contextmenustrip with notify icon

            contextMenuStrip1.Show(830, 400);
            m_notifyIcon.Visible   = true;
            SkinColorBtn.IsEnabled = true;
            EditBtn.BorderBrush    = System.Windows.Media.Brushes.Green;
        }
Ejemplo n.º 59
0
        public ExampleTaskbarNotifier()
        {
            this.Topmost = true;

            this.components   = new System.ComponentModel.Container();
            this.contextMenu1 = new System.Windows.Forms.ContextMenu();
            this.exitMenu     = new System.Windows.Forms.MenuItem();
            this.openMenu     = new System.Windows.Forms.MenuItem();
            this.separMenu    = new System.Windows.Forms.MenuItem();

            // Initialize contextMenu1
            this.contextMenu1.MenuItems.AddRange(
                new System.Windows.Forms.MenuItem[] { this.exitMenu, this.separMenu, this.openMenu });

            // Initialize exitMenu
            this.exitMenu.Index  = 2;
            this.exitMenu.Text   = "Exit";
            this.exitMenu.Click += new System.EventHandler(this.exitMenu_Click);

            // Initialize openMenu
            this.openMenu.Index  = 0;
            this.openMenu.Text   = "Open";
            this.openMenu.Click += new System.EventHandler(this.openMenu_Click);
            //this.openMenu.MenuItems.Add(new ToolStripSeparator());

            // Initialize separatorMenu
            this.separMenu.Index = 1;
            this.separMenu.Text  = "-";

            // Create the NotifyIcon.
            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);

            // The Icon property sets the icon that will appear
            // in the systray for this application.
            notifyIcon1.Icon = new Icon("../../Resources/amcc.ico");

            // The ContextMenu property sets the menu that will
            // appear when the systray icon is right clicked.
            notifyIcon1.ContextMenu = this.contextMenu1;

            // The Text property sets the text that will be displayed,
            // in a tooltip, when the mouse hovers over the systray icon.
            notifyIcon1.Text    = "KRT Systems";
            notifyIcon1.Visible = true;

            InitializeComponent();
        }
Ejemplo n.º 60
-1
        public NotifyIconHandler(System.Drawing.Icon standardIcon, System.Drawing.Icon workingIcon)
        {
            StandardIcon = standardIcon;
            WorkingIcon = workingIcon;

            NotifyIcon = new System.Windows.Forms.NotifyIcon { BalloonTipText = "GitList", Icon = standardIcon, Visible = true};

            var menu = new System.Windows.Forms.ContextMenu();
            menu.MenuItems.Add("Show", delegate(object sender, EventArgs e)
            {
                NotifyDoubleClick(sender, null);
            });
            menu.MenuItems.Add("Exit", delegate(object sender, EventArgs e)
            {
                Application.Current.Shutdown();
            });

            NotifyIcon.ContextMenu = menu;

            NotifyIcon.MouseDoubleClick += (sender, e) => NotifyDoubleClick(sender, e);
            NotifyIcon.BalloonTipClicked += (sender, e) => BalloonTipClick(sender, e);

            ShowAlert("GitList is running...", TimeSpan.FromSeconds(30));

            AutoShowInSystemTray();
        }