Esempio n. 1
0
		public BalloonToolTipViewModel()
		{
			Title = "";
			RemoveItemCommand = new RelayCommand(OnRemoveItem);
			ClearCommand = new RelayCommand(OnClear);
			customBalloonView = new Views.BalloonToolTipView();
			customBalloonView.DataContext = this;
		}
Esempio n. 2
0
        public SearchPageViewModel()
        {
            _messengerService = Resolver.Instance.Resolve<IMessengerService>();

            SearchCommand = new RelayCommand(OnSearch, CanExecuteSearch);
            ToggleSearchBarCommand = new RelayCommand(OnToggleSearchBar);
            PauseSearchCommand = new RelayCommand(OnPauseSearch, CanPauseSearch);
            ResumeSearchCommand = new RelayCommand(OnResumeSearch, CanResumeSearch);
        }
Esempio n. 3
0
		public BalloonToolTipViewModel(string title, string text, Brush foregroundColor, Brush backgroundColor)
		{
			Items.Clear();
			Title = "";
			Add(title, text, foregroundColor, backgroundColor);
			RemoveItemCommand = new RelayCommand(OnRemoveItem);
			ClearCommand = new RelayCommand(OnClear);
			customBalloonView = new Views.BalloonToolTipView();
			customBalloonView.DataContext = this;
		}
Esempio n. 4
0
        public MessageBoxViewModel(string title, string message, MessageBoxButton messageBoxButton, MessageBoxImage messageBoxImage, bool isException = false)
        {
            OkCommand = new RelayCommand(OnOk);
            CancelCommand = new RelayCommand(OnCancel);
            YesCommand = new RelayCommand(OnYes);
            NoCommand = new RelayCommand(OnNo);
            CopyCommand = new RelayCommand(OnCopy);
            Title = title ?? "Firesec";
            if (title == null && isException)
                Title = "Во время работы программы произошла ошибка";

            IsException = isException;
            Message = message;
            SetButtonsVisibility(messageBoxButton);
            SetImageVisibility(messageBoxImage);

            Result = MessageBoxResult.None;
            Sizable = false;
        }
Esempio n. 5
0
		public ShellViewModel(ClientType clientType)
		{
			ClientType = clientType;
			_emptyGridColumn = new GridLength(0, GridUnitType.Pixel);
			_splitterDistance = RegistrySettingsHelper.GetDouble(ClientType + ".Shell.SplitterDistance");
			if (_splitterDistance == 0)
				_splitterDistance = 1;
			Width1 = new GridLength(_splitterDistance, GridUnitType.Star);
			LeftPanelVisible = true;
			AllowHelp = true;
			AllowMaximize = true;
			AllowMinimize = true;
			ContentFotter = null;
			ContentItems = new ObservableCollection<IViewPartViewModel>();
			MinimizeCommand = new RelayCommand<MinimizeTarget>(OnMinimize);
			TextVisibility = !RegistrySettingsHelper.GetBool(ClientType + ".Shell.TextVisibility");
			RibbonVisible = false;
			ToolbarVisible = true;
		}
Esempio n. 6
0
		public ShortcutItem()
		{
			openFolderCommand = new RelayCommand(x => buttonClicked(false));
			startProgramCommand = new RelayCommand(x => buttonClicked(true));
		}
		// Constructor
		public MainWindowContentViewModel()
		{
			showSaveText = false;

			// Collections and filter
            items = new ObservableCollection<ShortcutItem>();
			itemCollectionView = CollectionViewSource.GetDefaultView(items);
			itemCollectionView.Filter = listBoxFilterItems;

			// Events
			EventSystem.RegisterCallbackOnEvent("dataDropped", dataDropped);
			EventSystem.RegisterCallbackOnEvent("dragOver", dragOver);

			// Commands
			saveItemsCommand = new RelayCommand(x => saveItems());
			saveItemsAsCommand = new RelayCommand(x => currentFileName = MainData.GetInstance().SaveAsItems(items));			
			copyItemPathCommand = new RelayCommand(x => copyPathToClipboard());
			removeItemCommand = new RelayCommand(x => removeItemFromList());
			clearListCommand = new RelayCommand(x => items.Clear());
			importItemsCommand = new RelayCommand(x =>
			{
				string filePath;
				addItemsToList(MainData.GetInstance().LoadShortcutItemsWithDialog(out filePath));
				currentFileName = filePath;
            });

			// Load previously open items
			if (File.Exists(Settings.Default.lastOpenedList) == true)
			{
				currentFileName = Settings.Default.lastOpenedList;
				addItemsToList(MainData.GetInstance().LoadShortcutItemsWithoutDialog(Settings.Default.lastOpenedList));
			}
		}
Esempio n. 8
0
        /// <summary>
        /// Creates new instance of <see cref="EpisodesViewModel"/>
        /// </summary>
        /// <param name="logger">Instance of <see cref="ILogger"/></param>
        /// <param name="playlist">Instance of <see cref="IPlayList"/></param>
        /// <param name="loaderFactory">Instance of <see cref="ILoaderFactory"/></param>
        /// <param name="navigationService">Instance of <see cref="INavigationService"/></param>
        /// <param name="applicationSettingsHelper">Instance of <see cref="IApplicationSettingsHelper"/></param>
        /// <param name="downloadManager">Instance of <see cref="IDownloadManager"/></param>
        public EpisodesViewModel(
            ILogger logger,
            INavigationService navigationService,
            IApplicationSettingsHelper applicationSettingsHelper,
            IDownloadManager downloadManager,
            IEpisodeListManager episodeListManager)
        {
            this.logger = logger;
            this.navigationService = navigationService;
            this.applicationSettingsHelper = applicationSettingsHelper;
            this.downloadManager = downloadManager;
            this.episodeListManager = episodeListManager;

            RefreshCommand = new RelayCommand(loadEpisodeListFromServer);
            DownloadCommand = new RelayCommand(downloadEpisode);
            CancelDownloadCommand = new RelayCommand((Action<object>)cancelDownload);
            DeleteCommand = new RelayCommand((Action<object>)deleteEpisodeFromStorage);
            PlayCommand = new RelayCommand((Action<object>)playEpisode);
            AddToPlaylistCommand = new RelayCommand((Action<object>)addToPlaylistCommand);
            ClearPlaylistCommand = new RelayCommand((Action)clearPlaylistCommand);

            Application.Current.Resuming += onAppResuming;
            Application.Current.Suspending += (_, __) => unregisterUpdaterCompletionHandler();
            Application.Current.UnhandledException += (_, __) => unregisterUpdaterCompletionHandler();
            backgroundUpdaterTask = BackgroundTaskRegistration.AllTasks
                .Where(t => t.Value.Name == Constants.BackgroundUpdaterTaskName)
                .Select(t => t.Value)
                .FirstOrDefault();
            Initialization = initializeAsync();
            logger.LogMessage("EpisodesViewModel: Initialized.", LoggingLevel.Information);
        }
Esempio n. 9
0
        /// <summary>
        /// Creates instance of <see cref="PlayerViewModel"/>
        /// </summary>
        /// <param name="logger">Instance of <see cref="ILogger"/></param>
        /// <param name="playlist">Instance of <see cref="IPlayList"/></param>
        /// <param name="applicationSettingsHelper">Instance of <see cref="IApplicationSettingsHelper"/></param>
        /// <param name="navigationService">Instance of <see cref="INavigationService"/></param>
        public PlayerViewModel(
            ILogger logger,
            IApplicationSettingsHelper applicationSettingsHelper,
            INavigationService navigationService,
            IPlaybackManager playbackManager)
        {
            this.logger = logger;
            this.navigationService = navigationService;
            this.applicationSettingsHelper = applicationSettingsHelper;
            this.playbackManager = playbackManager;
            pauseIcon = new SymbolIcon(Symbol.Pause);
            playIcon = new SymbolIcon(Symbol.Play);
            PlayButtonIcon = playIcon;
            progressUpdateTimer = new DispatcherTimer();

            // Using explicit casts here because of http://stackoverflow.com/questions/2057146/compiler-ambiguous-invocation-error-anonymous-method-and-method-group-with-fun
            PreviousTrackCommand = new RelayCommand((Action)onPreviousTrackAction);
            NextTrackCommand = new RelayCommand((Action)onNextTrackAction);
            PlayPauseCommand = new RelayCommand((Action)onPlayPauseAction);

            Application.Current.Suspending += onAppSuspending;
            Application.Current.Resuming += onAppResuming;

            Initialization = initializeAsync();
            logger.LogMessage("Foreground audio player initialized.", LoggingLevel.Information);
        }