Exemple #1
0
        public TrayNotifier(ICalDavSynchronizerCommands calDavSynchronizerCommands)
        {
            if (calDavSynchronizerCommands == null)
            {
                throw new ArgumentNullException(nameof(calDavSynchronizerCommands));
            }
            _calDavSynchronizerCommands = calDavSynchronizerCommands;

            var trayMenu = new ContextMenu();

            trayMenu.MenuItems.Add("Synchronize now", delegate { SynchronizeNow(); });
            trayMenu.MenuItems.Add("Reports", delegate { ShowReports(); });
            trayMenu.MenuItems.Add("Status", delegate { ShowProfileStatuses(); });
            trayMenu.MenuItems.Add("-");
            trayMenu.MenuItems.Add("Synchronization profiles", delegate { ShowOptions(); });
            trayMenu.MenuItems.Add("General options", delegate { ShowGeneralOptions(); });
            trayMenu.MenuItems.Add("-");
            trayMenu.MenuItems.Add("About", delegate { ShowAbout(); });

            // 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.
            _nofifyIcon      = new NotifyIcon();
            _nofifyIcon.Text = ComponentContainer.MessageBoxTitle;
            _nofifyIcon.Icon = Resources.ApplicationIcon;

            // Add menu to tray icon and show it.
            _nofifyIcon.ContextMenu       = trayMenu;
            _nofifyIcon.Visible           = true;
            _nofifyIcon.MouseDoubleClick += _nofifyIcon_MouseDoubleClick;
        }
    public TrayNotifier (ICalDavSynchronizerCommands calDavSynchronizerCommands)
    {
      if (calDavSynchronizerCommands == null)
        throw new ArgumentNullException (nameof (calDavSynchronizerCommands));
      _calDavSynchronizerCommands = calDavSynchronizerCommands;

      var trayMenu = new ContextMenu();
      trayMenu.MenuItems.Add ("Synchronize now", delegate { SynchronizeNow(); });
      trayMenu.MenuItems.Add ("Reports", delegate { ShowReports(); });
      trayMenu.MenuItems.Add ("Status", delegate { ShowProfileStatuses(); });
      trayMenu.MenuItems.Add ("-");
      trayMenu.MenuItems.Add ("Synchronization profiles", delegate { ShowOptions(); });
      trayMenu.MenuItems.Add ("General options", delegate { ShowGeneralOptions(); });
      trayMenu.MenuItems.Add ("-");
      trayMenu.MenuItems.Add ("About", delegate { ShowAbout(); });

      // 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.
      _nofifyIcon = new NotifyIcon();
      _nofifyIcon.Text = ComponentContainer.MessageBoxTitle;
      _nofifyIcon.Icon = Resources.ApplicationIcon;
      
      // Add menu to tray icon and show it.
      _nofifyIcon.ContextMenu = trayMenu;
      _nofifyIcon.Visible = true;
      _nofifyIcon.MouseDoubleClick += _nofifyIcon_MouseDoubleClick;
    }
        public ProfileStatusViewModel(Guid profileId, ICalDavSynchronizerCommands calDavSynchronizerCommands)
        {
            if (calDavSynchronizerCommands == null)
            {
                throw new ArgumentNullException(nameof(calDavSynchronizerCommands));
            }

            ProfileId = profileId;
            _calDavSynchronizerCommands = calDavSynchronizerCommands;

            ShowOptionsCommand = new DelegateCommand(_ => { _calDavSynchronizerCommands.ShowOptionsAsync(ProfileId); });
            ShowLatestSynchronizationReportCommand = new DelegateCommand(_ => { _calDavSynchronizerCommands.ShowLatestSynchronizationReport(ProfileId); });
        }
    public ProfileStatusesViewModel (ICalDavSynchronizerCommands calDavSynchronizerCommands)
    {
      if (calDavSynchronizerCommands == null)
        throw new ArgumentNullException (nameof (calDavSynchronizerCommands));

      _calDavSynchronizerCommands = calDavSynchronizerCommands;
      _timer = new Timer();
      _timer.Tick += delegate
      {
        foreach (var profileStatusViewModel in Profiles)
          profileStatusViewModel.RecalculateLastRunAgoInMinutes();
      };
      _timer.Interval = 50 * 1000;
      _timer.Enabled = true;
    }
    public ProfileStatusViewModel (Guid profileId, ICalDavSynchronizerCommands calDavSynchronizerCommands)
    {
      if (calDavSynchronizerCommands == null)
        throw new ArgumentNullException (nameof (calDavSynchronizerCommands));

      ProfileId = profileId;
      _calDavSynchronizerCommands = calDavSynchronizerCommands;

      ShowOptionsCommand = new DelegateCommand (_ =>
      {
        _calDavSynchronizerCommands.ShowOptions (ProfileId);
      });
      ShowLatestSynchronizationReportCommand = new DelegateCommand (_ =>
      {
        _calDavSynchronizerCommands.ShowLatestSynchronizationReport (ProfileId);
      });
    }
Exemple #6
0
        public ProfileStatusesViewModel(ICalDavSynchronizerCommands calDavSynchronizerCommands)
        {
            if (calDavSynchronizerCommands == null)
            {
                throw new ArgumentNullException(nameof(calDavSynchronizerCommands));
            }

            _calDavSynchronizerCommands = calDavSynchronizerCommands;
            _timer       = new Timer();
            _timer.Tick += delegate
            {
                foreach (var profileStatusViewModel in Profiles)
                {
                    profileStatusViewModel.RecalculateLastRunAgoInMinutes();
                }
            };
            _timer.Interval = 50 * 1000;
            _timer.Enabled  = true;
        }
Exemple #7
0
        public TransientProfileStatusesViewModel(ICalDavSynchronizerCommands calDavSynchronizerCommands, Contracts.Options[] profiles)
        {
            if (calDavSynchronizerCommands == null)
            {
                throw new ArgumentNullException(nameof(calDavSynchronizerCommands));
            }

            _calDavSynchronizerCommands = calDavSynchronizerCommands;
            _timer       = new Timer();
            _timer.Tick += delegate
            {
                foreach (var profileStatusViewModel in Profiles)
                {
                    profileStatusViewModel.RecalculateLastRunAgo();
                }
            };
            _timer.Interval = 5 * 1000;
            _timer.Enabled  = true;
            NotifyProfilesChanged(profiles);
        }
 public PermanentStatusesViewModel(IUiService uiService, ICalDavSynchronizerCommands commands, Contracts.Options[] options)
 {
     _commands  = commands ?? throw new ArgumentNullException(nameof(commands));
     _uiService = uiService ?? throw new ArgumentNullException(nameof(uiService));
     _summaryChache.NotifyProfilesChanged(options);
 }
Exemple #9
0
 public PermanentStatusesViewModel(IUiService uiService, ICalDavSynchronizerCommands commands)
 {
     _commands  = commands ?? throw new ArgumentNullException(nameof(commands));
     _uiService = uiService ?? throw new ArgumentNullException(nameof(uiService));
 }