示例#1
0
        private void StartApp(object sender, StartupEventArgs e)
        {
            // Check if the app is already running
            var appGuid = ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), false).GetValue(0)).Value;

            _singleAppMutex = new Mutex(false, string.Format(@"Global\{0}", appGuid));

            if (!_singleAppMutex.WaitOne(0, false))
            {
                MessageBox.Show("An instance of ReadySet is already running", "Unable to start ReadySet", MessageBoxButton.OK, MessageBoxImage.Exclamation);

                Shutdown();
            }

            _viewModel = new ViewModels.CoreMenuViewModel();

            _icon             = new Hardcodet.Wpf.TaskbarNotification.TaskbarIcon();
            _icon.ContextMenu = new Views.CoreMenuView(_viewModel);
            _icon.ToolTipText = "ReadySet";
            _icon.Icon        = ReadySet.Properties.Resources.icon_small;

            _viewModel.CloseRequest += CloseRequested;

            _hotKey = new Core.GlobalHotKey(Key.C, Core.KeyModifier.Shift | Core.KeyModifier.Win, HotKeyPressed);
        }
示例#2
0
        void App_Startup(object sender, StartupEventArgs e)
        {
            for (int i = 0; i != e.Args.Length; ++i)
            {
                if (e.Args[i] == "/SilentMode")
                {
                    IsSilentMode = true;
                }
            }

            if (IsSilentMode)
            {
                notifyIcon = (Hardcodet.Wpf.TaskbarNotification.TaskbarIcon) FindResource("NotifyIcon");
            }
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public TaskbarIcon()
        {
            _icon = new Hardcodet.Wpf.TaskbarNotification.TaskbarIcon {
                Visibility = Visibility.Hidden
            };

            _icon.TrayMouseDoubleClick += OnTrayMouseDoubleClick;
            _icon.TrayLeftMouseDown    += OnTrayLeftMouseDown;
            _icon.TrayLeftMouseUp      += OnTrayLeftMouseUp;
            _icon.TrayMiddleMouseDown  += OnTrayMiddleMouseDown;
            _icon.TrayMiddleMouseUp    += OnTrayMiddleMouseUp;
            _icon.TrayRightMouseDown   += OnTrayRightMouseDown;
            _icon.TrayRightMouseUp     += OnTrayRightMouseUp;

            _icon.TrayPopupOpen += OnTrayPopupOpen;
        }
示例#4
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Hardcodet.Wpf.TaskbarNotification.TaskbarIcon taskbarIcon = new Hardcodet.Wpf.TaskbarNotification.TaskbarIcon();
     try
     {
         taskbarIcon.IconSource            = new BitmapImage(new Uri("pack://application:,,,/L2KDBIcon.ico"));
         taskbarIcon.ToolTipText           = "L2KDB Server";
         taskbarIcon.TrayMouseDoubleClick += (a, b) =>
         {
             if (this.Visibility != Visibility.Visible)
             {
                 this.Show();
             }
             else
             {
                 this.Hide();
             }
         };
     }
     catch (Exception)
     {
     }
     this.Hide();
     Diagnotor.CurrentDiagnotor = new AdvancedDiagnotor(Output, Dispatcher);
     Diagnotor.CurrentDiagnotor.LogError("==========================================");
     Diagnotor.CurrentDiagnotor.LogError("=Enter 'Stop' to stop and exit the server=");
     Diagnotor.CurrentDiagnotor.LogError("==========================================");
     Task.Run(() =>
     {
         try
         {
             core = new ServerCore(Windows.Storage.ApplicationData.Current.LocalFolder.Path + "\\Databases\\",
                                   Windows.Storage.ApplicationData.Current.LocalFolder.Path + "\\Server-Config\\");
             core.Start();
         }
         catch (Exception e)
         {
             Diagnotor.CurrentDiagnotor.LogError(e.Message);
         }
     });
 }
示例#5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ExitIfAlreadyRunning();
            // StartServer();

            _container = new WindsorContainer().Install(FromAssembly.This());

            //create the notifyicon (it's a resource declared in NotifyIconResources.xaml
            notifyIcon = (Hardcodet.Wpf.TaskbarNotification.TaskbarIcon)FindResource("NotifyIcon");

            //make sure the notifyIcon's context is resolved from the container
            notifyIcon.DataContext = _container.Resolve <NotifyIconViewModel>();


            PopTheWindow();
            var scheduler = _container.Resolve <Scheduler>();
            var interval  = _container.Resolve <Display.Settings.Context>().GetInterval().Value;

            scheduler.Repeat(PopTheWindow, Convert.ToDouble(interval));
            PopTheWindow();
        }
        public App()
        {
            try
            {
                System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly();

                System.Windows.Controls.MenuItem btnQuit = new System.Windows.Controls.MenuItem();
                btnQuit.Name        = "btnQuit";
                btnQuit.Header      = "Quit";
                btnQuit.IsCheckable = false;
                btnQuit.Click      += btnQuit_Click;

                System.Windows.Controls.ContextMenu cntxRemoteExecuteServer = new System.Windows.Controls.ContextMenu();
                cntxRemoteExecuteServer.Items.Add(btnQuit);
                cntxRemoteExecuteServer.Name = "cntxIDBrowserServiceStandalone";

                using (System.IO.Stream file = thisExe.GetManifestResourceStream("IDBrowserServiceStandalone.Images.Antenna.ico"))
                {
                    ApplicationIcon = new System.Drawing.Icon(file);
                }

                taskbarIcon             = new Hardcodet.Wpf.TaskbarNotification.TaskbarIcon();
                taskbarIcon.Icon        = ApplicationIcon;
                taskbarIcon.ContextMenu = cntxRemoteExecuteServer;

                hostIDBrowserService = new System.ServiceModel.ServiceHost(typeof(IDBrowserServiceCode.Service));
                hostIDBrowserService.Open();

                taskbarIcon.ShowBalloonTip("Server started", System.String.Format("IDBrowserService started on: {0}", hostIDBrowserService.BaseAddresses[0]), Hardcodet.Wpf.TaskbarNotification.BalloonIcon.Info);
            }
            catch (Exception e)
            {
                if (taskbarIcon != null)
                {
                    taskbarIcon.ShowBalloonTip("Error", e.ToString(), Hardcodet.Wpf.TaskbarNotification.BalloonIcon.Error);
                }
                ;
            }
        }
示例#7
0
        public void Show(string title, string message, Action <MouseEventArgs> onClick)
        {
            if (!Enabled)
            {
                return;
            }

            Application.Current.Dispatcher.Invoke(() =>
            {
                int timeout          = 5000;
                FancyBalloon balloon = new FancyBalloon(timeout);
                balloon.BalloonText  = title;
                balloon.DataContext  = message;
                Hardcodet.Wpf.TaskbarNotification.TaskbarIcon icon = new Hardcodet.Wpf.TaskbarNotification.TaskbarIcon();
                icon.Visibility = Visibility.Hidden;
                icon.ShowCustomBalloon(balloon, PopupAnimation.Slide, timeout);
                balloon.MouseLeftButtonDown += (sender, e) =>
                {
                    e.Handled = false;
                    onClick(e);
                };
            });
        }
示例#8
0
        public MainWindowViewModel()
        {
            TabWidth           = 0;
            TabHeight          = 60;
            ChartsButtonHeight = 25;
            WindowHeight       = _defaultWindowsHeight;
            WindowWidth        = _defaultWindowWidth;
            MainWidth          = 400;
            WindowPosLeft      = SystemParameters.WorkArea.Right - WindowWidth;
            ChartsLabel        = Resources.showChartsLabel;

            Charts = new ObservableCollection <ChartsElement>();

            tb = new Hardcodet.Wpf.TaskbarNotification.TaskbarIcon();
            //tb.Icon = new System.Drawing.Icon(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory())) + "/Config/Icon/Office_Supplies-512.ico");

            tb.Icon = new System.Drawing.Icon(Path.GetDirectoryName(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory)) + "/LifesAssistant/Config/Icon/Office_Supplies-512.ico");

            ExecuteTabChangedCommand("Calendar");

            SetEventsHandler();

            WaterTabViewModel.Instance.DayWaterNorm = ConfigRepository.Instance.GetCurrentConfig().Capasity;
        }
示例#9
0
 public DropArea(TaskQueue q)
 {
     InitializeComponent();
     icon = null;
     queue = q;
 }
示例#10
0
 public DropArea(TaskQueue q, Hardcodet.Wpf.TaskbarNotification.TaskbarIcon Icon)
 {
     InitializeComponent();
     icon = Icon;
     queue = q;
 }