Пример #1
0
        public AppModel(TaskbarIcon notifyIcon, TaskbarItemInfo taskbarItemInfo)
        {
            m_isAddServerUrlValid = true;
            m_updateManager       = new AutoUpdater();
            m_notifyIcon          = notifyIcon;
            Enum.TryParse(Settings.Default.ViewMode, true, out m_viewMode);
            m_taskbarItemInfo = taskbarItemInfo;
            m_servers         = new ObservableCollection <ServerViewModel>();
            m_settings        = PersistedUserSettings.Open <UserSettings>() ?? new UserSettings {
                Servers = new List <SavedJenkinsServers>()
            };
            m_timer          = new DispatcherTimer(TimeSpan.FromSeconds(c_projectUpdateInterval), DispatcherPriority.Background, (sender, args) => Update(), Dispatcher.CurrentDispatcher);
            Status           = new StatusViewModel();
            m_subscribedJobs = new ObservableCollection <JobViewModel>();

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                m_updateManager.CheckForUpdate();
                m_updateManager.PropertyChanged += UpdateManager_PropertyChanged;
                m_updateTimer = new DispatcherTimer(TimeSpan.FromHours(4), DispatcherPriority.Background, CheckForUpdate, Dispatcher.CurrentDispatcher);
            }
            AutoStartOnStartup = IsAutoStartRegistered;

            Initialize();
        }
Пример #2
0
		public AppModel(TaskbarIcon notifyIcon, TaskbarItemInfo taskbarItemInfo)
		{
			m_isAddServerUrlValid = true;
			m_updateManager = new AutoUpdater();
			m_notifyIcon = notifyIcon;
			Enum.TryParse(Settings.Default.ViewMode, true, out m_viewMode);
			m_taskbarItemInfo = taskbarItemInfo;
			m_servers = new ObservableCollection<ServerViewModel>();
			m_settings = PersistedUserSettings.Open<UserSettings>() ?? new UserSettings { Servers = new List<SavedJenkinsServers>() };
			m_timer = new DispatcherTimer(TimeSpan.FromSeconds(c_projectUpdateInterval), DispatcherPriority.Background, (sender, args) => Update(), Dispatcher.CurrentDispatcher);
			Status = new StatusViewModel();
			m_subscribedJobs = new ObservableCollection<JobViewModel>();

			if (ApplicationDeployment.IsNetworkDeployed)
			{
				m_updateManager.CheckForUpdate();
				m_updateManager.PropertyChanged += UpdateManager_PropertyChanged;
				m_updateTimer = new DispatcherTimer(TimeSpan.FromHours(4), DispatcherPriority.Background, CheckForUpdate, Dispatcher.CurrentDispatcher);
			}

			Initialize();
		}