Example #1
1
        /// <summary>Initializes a new instance of the <see cref="Shell"/> class.</summary>
        /// <param name="msgBoxService">The msg Box Service.</param>
        /// <param name="eventAggregator"></param>
        /// <param name="commands">The commands.</param>
        /// <param name="fileManagerService">The file Manager Service.</param>
        /// <param name="buttonsCommands">The buttons Commands.</param>
        public Shell(
            IMessageBoxService msgBoxService,
            IEventAggregator eventAggregator,
            List<IToolbarCommand> commands,
            IFileManagerService fileManagerService,
            List<IButtonsCommand> buttonsCommands)
        {
            this.InitializeComponent();

            // Wire up our view presenters
            var toolbarButtonsView = new ToolbarView { Dock = DockStyle.Top };
            var toolbarViewPresenter = new ToolbarPresenter(toolbarButtonsView, commands);

            var buttonCommandView = new ButtonView { Dock = DockStyle.Bottom };
            var buttonCommandViewPresenter = new ButtonsPresenter(buttonCommandView, buttonsCommands);

            var levelsTreeView = new LevelsView { Dock = DockStyle.Fill };
            var levelsTreeViewPresenter = new LevelsViewPresenter(levelsTreeView, msgBoxService, eventAggregator);

            var infoView = new InformationView { Dock = DockStyle.Fill };
            var inforViewPresenter = new InformationViewPresenter(infoView);

            // Wire up our views
            this.toolbarView = toolbarButtonsView;
            this.buttonView = buttonCommandView;
            this.levelsView = levelsTreeView;
            this.informationView = infoView;

            // Wire up our event messaging
            this.aggregator = eventAggregator;
            this.aggregator.GetEvent<CloseShellMessage>().Subscribe(this.OnCloseShell);

            // Place the views in the correct regions
            this.InjectViews();
        }
Example #2
0
        public MainWindowViewModel()
        {
            #region Obtain Services
            try
            {
                messageBoxService = Resolve<IMessageBoxService>();
                openFileService = Resolve<IOpenFileService>();
            }
            catch
            {
                Logger.Error( "Error resolving services");
                throw new ApplicationException("Error resolving services");
            }
            #endregion

            #region Commands

            //New VM Command
            newVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteNewVMCommand,
                ExecuteDelegate = x => ExecuteNewVMCommand()
            };


            //Open VM Command
            openVMCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => CanExecuteOpenVMCommand,
                ExecuteDelegate = x => ExecuteOpenVMCommand()
            };
            #endregion


        }
        public MainViewModel(IFileDialogService fileDialogService, IMessageBoxService messageBoxService, IDirtyService dirtyService, IViewService viewService, ILifetimeScope lifetimeScope)
        {
            if (fileDialogService == null) throw new ArgumentNullException(nameof(fileDialogService));
            if (messageBoxService == null) throw new ArgumentNullException(nameof(messageBoxService));
            if (dirtyService == null) throw new ArgumentNullException(nameof(dirtyService));
            if (viewService == null) throw new ArgumentNullException(nameof(viewService));
            if (lifetimeScope == null) throw new ArgumentNullException(nameof(lifetimeScope));
            

            _fileDialogService = fileDialogService;
            _messageBoxService = messageBoxService;
            _dirtyService = dirtyService;
            _viewService = viewService;
            _lifetimeScope = lifetimeScope;
            

            dirtyService.PropertyChanged += DirtyService_PropertyChanged;

            NewCommand = new RelayCommand(New);
            OpenCommand = new RelayCommand(Open);
            SaveCommand = new RelayCommand(() => Save(), CanSave);
            SaveAsComand = new RelayCommand(() => SaveAs());
            ExitCommand = new RelayCommand(Exit);
            AboutCommand = new RelayCommand(About);
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        /// <param name="listViews">A list of views to display.</param>
        /// <param name="messageBoxService">A message box service.</param>
        /// <param name="itemService">An item service.</param>
        /// <param name="navigationService">A navigation service.</param>
        public MainViewModel(IEnumerable<object> listViews, IMessageBoxService messageBoxService,
			IItemService itemService, INavigationService navigationService)
        {
            if (messageBoxService == null)
                throw new ArgumentNullException("messageBoxService");
            if (itemService == null)
                throw new ArgumentNullException("itemService");
            if (navigationService == null)
                throw new ArgumentNullException("navigationService");

            _messageBoxService = messageBoxService;
            _itemService = itemService;
            _navigationService = navigationService;

            _listViews = new ObservableCollection<object>();

            if (listViews != null)
            {
                foreach (object obj in listViews)
                {
                    _listViews.Add(obj);
                }
            }

            RegisterForMessages();
        }
        public ProjectIssuesViewModel(IUnityContainer container)
        {
            HeaderTitle = "Issues";

            _container = container;
            _context = _container.Resolve<TeamManagerDomainContext>("TM_DB");
            _modalDialogService = _container.Resolve<IModalDialogService>();
            _messageBoxService = _container.Resolve<IMessageBoxService>();

            Messanger.Get<ProjectSelectionMessage>().Subscribe(OnSelectedProjectChanged);

            GroupCriteria = new ObservableCollection<GroupItem>(new List<GroupItem>
                                                                    {
                                                                        new GroupItem("Tracker", "Tracker.Name"),
                                                                        new GroupItem("Priority", "Priority.Name"),
                                                                        new GroupItem("Creator", "Creator.UserName"),
                                                                        new GroupItem("Assigned member", "AssignedUser.UserName"),
                                                                    });

            EditIssueCommand = new DelegateCommand<Issue>(ExecuteEditIssue, issue => true);
            CreateIssueCommand = new DelegateCommand(ExecuteCreateIssue, CanExecuteCreateIssue);
            DeleteIssueCommand = new DelegateCommand<Issue>(ExecuteDeleteIssue, issue => true);
            OpenIssueCommand = new DelegateCommand<Issue>(ExecuteIssueNavigate, issue => true);
            GroupChangedCommand = new DelegateCommand<SelectionChangedEventArgs>(GroupChangedHandler, e => true);
            ClearGroupingCommand = new DelegateCommand(ClearGroupingExecute, () => true);
        }
Example #6
0
        public View2(IMessageBoxService messageBoxService)
        {
            _messageBoxService = messageBoxService;
            InitializeComponent();

            //button6.Click += (s, e) =>
            //                    {
            //                        _messageBoxService.ShowMessage("trala");
            //                    };
            button6.Click += (s, e) => _messageBoxService.ShowMessage("trala");

            //var lst = new List<Action>();
            //for(int i=0;i<5;++i)
            //{
            //    //int d = i;
            //    lst.Add(
            //        () => _messageBoxService.ShowMessage(d.ToString())
            //    );
            //}
            //lst.ForEach(e=>e());

            //var lst = new List<_____Anonymous_lambdsa_type_XY>();
            //for (int i = 0; i < 5; ++i)
            //{
            //    lst.Add(
            //        new _____Anonymous_lambdsa_type_XY(ref i, _messageBoxService)
            //    );
            //}
            //lst.ForEach(e => e.Anonymous_function_XX());
        }
        /// <summary>Initializes a new instance of the <see cref="LevelsViewPresenter"/> class.</summary>
        /// <param name="view">The view.</param>
        /// <param name="msgBoxService">The msg box service.</param>
        /// <param name="fileBrowserService">The file browser service.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="fileManagerService">The file Manager Service.</param>
        /// <param name="strategyService"></param>
        public LevelsViewPresenter(
            ILevelsView view,
            IMessageBoxService msgBoxService,
            IFileBrowserService fileBrowserService,
            IEventAggregator eventAggregator,
            IFileManagerService fileManagerService,
            IStrategyService strategyService)
        {
            // Wire up our services
            this.msgBoxService = msgBoxService;
            this.fileBrowserService = fileBrowserService;
            this.fileManagerService = fileManagerService;
            this.eventAggregator = eventAggregator;
            this.strategyService = strategyService;

            this.view = view;

            view.ViewLoad += this.LevelsViewOnViewLoad;
            view.SelectionChanged += this.LevelsViewOnSelectionChanged;
            view.LevelDrag += this.OnLevelItemDrag;
            view.LevelDragDrop += this.OnLevelDragDrop;
            view.LevelDragEnter += this.OnLevelDragEnter;

            view.Tree.AllowDrop = true;

            this.eventAggregator.GetEvent<SaveLevelsMessage>().Subscribe(this.OnSaveLevels);
            this.eventAggregator.GetEvent<AddLevelMessage>().Subscribe(this.OnAddLevel);
            this.eventAggregator.GetEvent<RemoveLevelMessage>().Subscribe(this.OnRemoveLevel);
            this.eventAggregator.GetEvent<OpenPartMessage>().Subscribe(this.OnOpenParts);
            this.eventAggregator.GetEvent<SaveStrategyMessage>().Subscribe(this.OnSaveStrategyEvent);
            this.eventAggregator.GetEvent<OpenStrategyMessage>().Subscribe(this.OnLoadStrategyEvent);
            this.eventAggregator.GetEvent<OpenLevelsMessage>().Subscribe(this.OnOpenLevelsEvent);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseController" /> class.
        /// </summary>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="readMeService">The read me service.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="messageBoxService">The message box service.</param>
        /// <param name="dialogService">The dialog service.</param>
        /// <param name="formsService">The forms service.</param>
        protected BaseController(
            IVisualStudioService visualStudioService,
            IReadMeService readMeService,
            ISettingsService settingsService,
            IMessageBoxService messageBoxService,
            IDialogService dialogService,
            IFormsService formsService)
        {
            //// init the tracing service first!
            TraceService.Initialize(
                settingsService.LogToTrace,
                false, //// log to console.
                settingsService.LogToFile,
                settingsService.LogFilePath,
                settingsService.DisplayErrors);

            TraceService.WriteLine("BaseController::Constructor");

            this.VisualStudioService = visualStudioService;
            this.ReadMeService = readMeService;
            this.SettingsService = settingsService;
            this.MessageBoxService = messageBoxService;
            this.DialogService = dialogService;
            this.FormsService = formsService;
        }
Example #9
0
        /// <summary>
        /// Initializes a new instance of the TvViewModel class.
        /// </summary>
        public TvViewModel(INavigationService navigationService, IConnectionManager connectionManager, IMessageBoxService messageBox) 
            : base(navigationService, connectionManager)
        {
            _messageBox = messageBox;
            RecentItems = new ObservableCollection<BaseItemDto>();
            Episodes = new List<BaseItemDto>();
            CanUpdateFavourites = true;
            if (IsInDesignMode)
            {
                SelectedTvSeries = new BaseItemDto
                {
                    Name = "Scrubs"
                };
                SelectedSeason = new BaseItemDto
                {
                    Name = "Season 1"
                };
                Episodes = new[]
                {
                    new BaseItemDto
                    {
                        Id = "e252ea3059d140a0274282bc8cd194cc",
                        Name = "1x01 - Pilot",
                        Overview =
                            "A Kindergarten teacher starts speaking gibberish and passed out in front of her class. What looks like a possible brain tumor does not respond to treatment and provides many more questions than answers for House and his team as they engage in a risky trial-and-error approach to her case. When the young teacher refuses any additional variations of treatment and her life starts slipping away, House must act against his code of conduct and make a personal visit to his patient to convince her to trust him one last time."
                    }
                }.ToList();
                SelectedEpisode = Episodes[0];

            }
            else
            {
                WireCommands();
            }
        }
 public void SetUp()
 {
     _model = Substitute.For<ILoginModel>();
     _messageService = Substitute.For<IMessageBoxService>();
     _wos = Substitute.For<IWindowOpeningService>();
     _uut = new LoginViewModel(_model, _messageService, _wos);
 }
        public ReservationDashBoardViewModel(IUnityContainer container, ILoggerFacade logger, IReservationManager reservationManager, ITableManager tableManager, IMessageBoxService messageBoxService, IDialogBoxService dialogBoxService)
        {
            this._logger = logger;
            this._container = container;
            this._reservationManager = reservationManager;
            this._tableManager = tableManager;
            this._messageBoxService = messageBoxService;
            this._dialogBoxService = dialogBoxService;
            this._reservationHours = new ObservableCollection<ReservationHour>();
            this._reservations = new MappedValueCollection();


            this.AddCommand = new DelegateCommand(this.OnAddCommand, () => { return this._noOfPersons > 0; });
            this.BrowseCommand = new DelegateCommand(this.OnBrowseCommand);
            this.ImportCommand = new DelegateCommand(this.OnImportCommand, () => { return !string.IsNullOrEmpty(this._tableXMLFile); });

            this._tables = this._tableManager.GetAll();
            
            // Assumption : Reservation duration is between 10 Am and 10 Pm
            this._minFromHour = 10;
            this._maxFromHour = 22;

            for (int hour = this._minFromHour; hour <= this._maxFromHour; hour++)
            {
                this._reservationHours.Add(new ReservationHour(hour));
            }

            this.FromHour = this._minFromHour;

            TableReservation.Common.ReservationsUpdatedEvent.Instance.Subscribe(this.ReservationsUpdated);
            this.ReservationsUpdated(Guid.NewGuid());
        }
        public OrderViewModel(
            Order order, 
            IMessageBoxService messageBoxService, 
            OrderServiceInvoker orderServiceInvoker)
        {
            this.messageBoxService = messageBoxService;
            this.orderServiceInvoker = orderServiceInvoker;
            this.Order = order;

            this.GotoEditModeCommand = new SimpleCommand<object, object>(
                x => !this.IsEnabled,
                ExecuteGotoEditModeCommand
            );

            this.DeleteOrderCommand = new SimpleCommand<object, object>(
                x => !this.IsEnabled && !operationInFlight,
                ExecuteDeleteOrderCommand
            );

            this.CancelEditModeCommand = new SimpleCommand<object, object>(
                x => this.IsEnabled,
                ExecuteCancelEditModeCommand
            );

            this.ChangeOrderAddressCommand = new SimpleCommand<object, object>(
                x => this.IsEnabled && !operationInFlight,
                ExecuteChangeOrderAddressCommand
            );
        }
 public VideoQueryForm(IMessageBoxService messageBoxService)
     : this()
 {
     if (messageBoxService == null)
         throw new ArgumentNullException("messageBoxService", "messageBoxService is null.");
     _messageBoxService = messageBoxService;
 }
        //====================================================================================================
        public AddBookingViewModel(IMessageBoxService mboxService, IConfigService configService, 
            IParentVm parent, Booking model)
        {
            _parent = parent;
            _mboxService = mboxService;
            _configService = configService;

            //Get Configuration
            AvailableDurations = _configService.GetAvailableDurations();

            //Set Commands
            SubmitCommand = new ActionCommand(OnSubmit, _=>_isFormValid);
            CancelCommand = new ActionCommand(OnCancel);

            //Set up the screen for Add or Display.
            if (model.Id == -1)
            {
                Model = model;
                Caption = "Add New Booking";
                IsAddMode = true;
            }
            else
            {
                Model = model;
                Caption = "Existing Booking";
                IsAddMode = false;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectsController" /> class.
        /// </summary>
        /// <param name="configurationService">The configuration service.</param>
        /// <param name="projectsService">The projects service.</param>
        /// <param name="nugetService">The nuget service.</param>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="readMeService">The read me service.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="messageBoxService">The message box service.</param>
        /// <param name="mockingServiceFactory">The mocking service factory.</param>
        /// <param name="resolverService">The resolver service.</param>
        /// <param name="viewModelViewsService">The view model views service.</param>
        /// <param name="viewModelAndViewsFactory">The view model and views factory.</param>
        public ProjectsController(
            IConfigurationService configurationService,
            IProjectsService projectsService,
            INugetService nugetService,
            IVisualStudioService visualStudioService,
            IReadMeService readMeService,
            ISettingsService settingsService,
            IMessageBoxService messageBoxService,
            IMockingServiceFactory mockingServiceFactory,
            IResolverService resolverService,
            IViewModelViewsService viewModelViewsService,
            IViewModelAndViewsFactory viewModelAndViewsFactory)
            : base(configurationService,
            visualStudioService,
            readMeService,
            settingsService,
            messageBoxService,
            resolverService)
        {
            TraceService.WriteLine("ProjectsController::Constructor");

            this.projectsService = projectsService;
            this.nugetService = nugetService;
            this.viewModelViewsService = viewModelViewsService;
            this.viewModelAndViewsFactory = viewModelAndViewsFactory;
            this.mockingService = mockingServiceFactory.GetMockingService();
        }
        /// <summary>Initializes a new instance of the <see cref="ShellViewPresenter"/> class.</summary>
        /// <param name="shell">The shell.</param>
        /// <param name="msgBoxService">The msg Box Service.</param>
        /// <param name="fileBrowserService">The file Browser Service.</param>
        /// <param name="eventAggregator">The event Aggregator.</param>
        /// <param name="systemInformationService">The system Information Service.</param>
        public ShellViewPresenter(
            IShellView shell, 
            IMessageBoxService msgBoxService, 
            IFileBrowserService fileBrowserService, 
            IEventAggregator eventAggregator, 
            ISystemInformationService systemInformationService)
        {
            // Wire up our services
            this.msgBoxService = msgBoxService;
            this.fileBrowserService = fileBrowserService;
            this.eventAggregator = eventAggregator;
            this.systemInformationService = systemInformationService;

            // Wire up our view
            this.view = shell;

            // Wire up view our events
            shell.FormClosed += this.ViewOnFormClosed;
            shell.Load += this.ViewOnLoad;
            shell.KeyUp += this.ViewOnKeyUp;
            shell.HelpRequested += this.ViewOnHelpRequested;

            // WindowHandle high contrast
            if (!this.systemInformationService.IsHighContrastColourScheme)
            {
                shell.BackColor = Color.White;
            }
        }
        /// <summary>
        /// Initializes a new instance of the PushViewModel class.
        /// </summary>
        public SettingsViewModel(
            IConnectionManager connectionManager,
            INavigationService navigationService,
            IApplicationSettingsService applicationSettings, 
            IMessageBoxService messageBox,
            IServerInfoService serverInfo)
            : base(navigationService, connectionManager)
        {
            _applicationSettings = applicationSettings.Legacy;
            _messageBox = messageBox;
            _serverInfo = serverInfo;

            if (IsInDesignMode)
            {
                FoundServers = new ObservableCollection<ServerInfo>
                {
                    new ServerInfo{Id = Guid.NewGuid().ToString(), Name = "Home", LocalAddress = "http://192.168.0.2:8096"}
                };
            }
            else
            {
                LoadingFromSettings = true;
                SendTileUpdates = SendToastUpdates = true;
                RegisteredText = AppResources.DeviceNotRegistered;
                LoadingFromSettings = false;

                SetStreamingQuality();

                _ignoreRunUnderLockChanged = true;
                RunUnderLock = App.SpecificSettings.PlayVideosUnderLock;
                _ignoreRunUnderLockChanged = false;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PluginsController" /> class.
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="pluginsService">The plugins service.</param>
        /// <param name="nugetService">The nuget service.</param>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="readMeService">The read me service.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="messageBoxService">The message box service.</param>
        /// <param name="dialogService">The dialog service.</param>
        /// <param name="formsService">The forms service.</param>
        /// <param name="translator">The translator.</param>
        public PluginsController(
            IFileSystem fileSystem,
            IPluginsService pluginsService,
            INugetService nugetService,
            IVisualStudioService visualStudioService,
            IReadMeService readMeService,
            ISettingsService settingsService,
            IMessageBoxService messageBoxService,
            IDialogService dialogService,
            IFormsService formsService,
            ITranslator<Tuple<DirectoryInfoBase, DirectoryInfoBase>, Plugins> translator)
            : base(visualStudioService, 
            readMeService, 
            settingsService, 
            messageBoxService,
            dialogService,
            formsService)
        {
            TraceService.WriteLine("PluginsController::Constructor");

            this.fileSystem = fileSystem;
            this.pluginsService = pluginsService;
            this.nugetService = nugetService;
            this.translator = translator;
        }
 public MainViewModel(IMarketplaceInformationService marketplaceInformationService, IMessageBoxService messageBoxService,
     IMarketplaceDetailService marketplaceDetailService)
 {
     _marketplaceInformationService = marketplaceInformationService;
     _messageBoxService = messageBoxService;
     _marketplaceDetailService = marketplaceDetailService;
 }
 public FormSuspectCarQuery(LicensePlateRepository licensePlateRepository,
     IMessageBoxService messageBoxService)
     : this()
 {
     if (messageBoxService == null) throw new ArgumentNullException("messageBoxService");
     _licensePlateRepository = licensePlateRepository;
     _messageBoxService = messageBoxService;
 }
Example #21
0
        public LoginViewModel(INavigationService navigationService, IMessageBoxService messageBoxService, IStravaService stravaService) : base(navigationService)
        {
            _stravaService = stravaService;
            _messageBoxService = messageBoxService;
            _stravaService.StatusEvent += OnStravaStatusEvent;

            this.LoginCommand = new RelayCommand(async () => await _stravaService.GetAuthorizationCode());
        }
Example #22
0
		NodeTabSaver(IMessageBoxService messageBoxService, IDocumentTab tab, IDocumentTreeNodeDecompiler documentTreeNodeDecompiler, IDecompiler decompiler, IDocumentViewer documentViewer, DocumentTreeNodeData[] nodes) {
			this.messageBoxService = messageBoxService;
			this.tab = tab;
			this.documentTreeNodeDecompiler = documentTreeNodeDecompiler;
			this.decompiler = decompiler;
			this.documentViewer = documentViewer;
			this.nodes = nodes;
		}
Example #23
0
 public OperationsView(IMessageBoxService messageBoxService, OperationsViewModel viewModel)
 {
     _messageBoxService = messageBoxService;
     ViewModel = viewModel;
     viewModel.OperationHasBeenSelected = MoveFocusToCategoryTextBox;
     InitializeComponent();
     this.DataContext = viewModel;
 }
Example #24
0
        public CompanyView(IMessageBoxService messageBoxService, IAsyncService asyncService,
			IDataService<Company> companyDataService)
        {
            _messageBoxService = messageBoxService;
            _asyncService = asyncService;
            _companyDataService = companyDataService;
            InitializeComponent();
        }
 public TileViewModelBase(
     IRegionManager regionManager,
     IMessageBoxService messageBoxService)
 {
     this.regionManager = regionManager;
     this.messageBoxService = messageBoxService;
     CloseViewCommand = new SimpleCommand<object, object>(ExecuteCloseViewCommand);
 }
		SearchServiceProvider(ITextSearchService2 textSearchService2, ITextStructureNavigatorSelectorService textStructureNavigatorSelectorService, ISearchSettings searchSettings, IMessageBoxService messageBoxService, [ImportMany] IEnumerable<Lazy<IReplaceListenerProvider>> replaceListenerProviders, IEditorOperationsFactoryService editorOperationsFactoryService) {
			this.textSearchService2 = textSearchService2;
			this.textStructureNavigatorSelectorService = textStructureNavigatorSelectorService;
			this.searchSettings = searchSettings;
			this.messageBoxService = messageBoxService;
			this.replaceListenerProviders = replaceListenerProviders.ToArray();
			this.editorOperationsFactoryService = editorOperationsFactoryService;
		}
Example #27
0
		public static void OpenWebPage(string url, IMessageBoxService messageBoxService) {
			try {
				Process.Start(url);
			}
			catch {
				messageBoxService.Show(dnSpy_Resources.CouldNotStartBrowser);
			}
		}
        public UserListViewViewModel(IViewAwareStatus viewAwareStatus, IMessageBoxService messageBoxService, IUserService userService)
        {
            this.viewAwareStatus = viewAwareStatus;
            this.messageBoxService = messageBoxService;
            this.userService = userService;
            Mediator.Instance.Register(this);

            this.viewAwareStatus.ViewLoaded += new Action(viewAwareStatus_ViewLoaded);
        }
		public ViewModel2(IEventAggregator eventAggregator, IBusinessService businessService,
		                  IMessageBoxService messageBoxService)
		{
			_eventAggregator = eventAggregator;
		    _businessService = businessService;
			_messageBoxService = messageBoxService;
			
			VmTitle = Names.View2;
		}
Example #30
0
        public View3(IMessageBoxService messageBoxService, IAsyncService asyncService,
			IEnumerable<IDataService<Person>> pDataService, IEventAggregator eventAggregator)
        {
            _messageBoxService = messageBoxService;
            _pDataServices = pDataService;
            _eventAggregator = eventAggregator;
            _asyncService = asyncService;
            InitializeComponent();
        }
Example #31
0
 public OpenLinkCommand(IOpenUrlService openUrlService, IMessageBoxService messageBoxService)
 {
     OpenUrlService    = openUrlService;
     MessageBoxService = messageBoxService;
 }
Example #32
0
 public Main_ViewModel(IApplicationInfo applicationInfo, IMessageBoxService dialogService)
 {
     _messageboxService = dialogService;
     Info          = applicationInfo;
     About_Command = new DelegateCommand(Handler_About_Command);
 }
Example #33
0
 public static IFileBaseViewModel CreateNewDocument(IDocumentModel documentModel,
                                                    IMessageBoxService IMsgBox)
 {
     return(new EdiViewModel(documentModel, IMsgBox));
 }
Example #34
0
 /// <summary>
 /// Load an Edi text editor file based on an <seealso cref="IDocumentModel"/>
 /// representation and a <seealso cref="ISettingsManager"/> instance.
 /// </summary>
 /// <param name="dm"></param>
 /// <param name="o">Should point to a <seealso cref="ISettingsManager"/> instance.</param>
 /// <returns></returns>
 public static EdiViewModel LoadFile(IDocumentModel dm,
                                     object o,
                                     IMessageBoxService msgBox)
 {
     return(LoadFile(dm, o as ISettingsManager, msgBox));
 }
Example #35
0
 OpenLatestBuildUrlCommand(IMessageBoxService messageBoxService) => this.messageBoxService = messageBoxService;
Example #36
0
 public AddImageCommand(ComposeControlViewModel composeControlViewModel, ITwitterService twitterService, IMessageBoxService messageBoxService)
 {
     ComposeControlViewModel = composeControlViewModel;
     TwitterService          = twitterService;
     MessageBoxService       = messageBoxService;
 }
Example #37
0
 /// <summary>
 /// Initializes an instance of the FileDataUploaderViewModel class.
 /// </summary>
 /// <param name="openFileDialogService">File Dialog Service instance.</param>
 /// <param name="messageBoxService">Message Box Service instance.</param>
 /// <param name="configManager">Config Manager Service instance.</param>
 public FileDataUploaderViewModel(IOpenFileDialogService openFileDialogService, IMessageBoxService messageBoxService, IConfigurationManager configManager)
 {
     _openFileDialogService = openFileDialogService;
     _messageBoxService     = messageBoxService;
     _configManager         = configManager;
     InitializeBackgroundWorker();
 }
Example #38
0
        private static void loadPluginAssembly(string assemblyFile,
                                               IMiniUMLDocument windowViewModel,
                                               IMessageBoxService msgBox)
        {
            Assembly assembly;

            try
            {
                // Load the plugin assembly.
                assembly = Assembly.LoadFrom(assemblyFile);

                // Add an instance of each PluginModel found in the assembly to the plugin collection
                // and merge its resources into the plugin resource dictionary.
                foreach (Type type in assembly.GetTypes())
                {
                    if (!type.IsAbstract && typeof(PluginModelBase).IsAssignableFrom(type))
                    {
                        try
                        {
                            // Create PluginModel instance.
                            PluginModelBase pluginModel = Activator.CreateInstance(type, windowViewModel) as PluginModelBase;

                            // Plugin names must be unique
                            foreach (PluginModelBase p in PluginManager.PluginModels)
                            {
                                if (p.Name == pluginModel.Name)
                                {
                                    throw new Exception(Edi.Util.Local.Strings.STR_MSG_UML_PLugin_Duplicate);
                                }
                            }

                            // Get the shared resources from the plugin.
                            ResourceDictionary sharedResources = pluginModel.Resources;

                            // If we got any resources, merge them into our plugin resource dictionary.
                            if (sharedResources != null)
                            {
                                PluginManager.PluginResources.MergedDictionaries.Add(sharedResources);
                            }

                            // Add the plugin into the collection of plugins
                            PluginManager.AddPluginModel(pluginModel);
                        }
                        catch (Exception ex)
                        {
                            msgBox.Show(ex,
                                        string.Format(Edi.Util.Local.Strings.STR_MSG_ErrorLoadingPlugin, assemblyFile),
                                        Edi.Util.Local.Strings.STR_MSG_PluginNotLoaded,
                                        MsgBoxButtons.OK, MsgBoxImage.Error);

                            ////ExceptionManager.Register(ex,
                            ////    "Plugin not loaded.",
                            ////    "An error occured while initializing a plugin found in assembly " + assemblyFile + ".");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                msgBox.Show(ex,
                            string.Format(Edi.Util.Local.Strings.STR_MSG_ErrorWhileLoadingPlugin, assemblyFile),
                            Edi.Util.Local.Strings.STR_MSG_PluginNotLoaded,
                            MsgBoxButtons.OK, MsgBoxImage.Error);

                return;
            }
        }
Example #39
0
 public UriMouseProcessor(IWpfTextView wpfTextView, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IMessageBoxService messageBoxService)
 {
     this.wpfTextView       = wpfTextView ?? throw new ArgumentNullException(nameof(wpfTextView));
     this.messageBoxService = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));
     this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService ?? throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
     origCursor = wpfTextView.VisualElement.Cursor;
     wpfTextView.VisualElement.PreviewKeyDown += VisualElement_PreviewKeyDown;
     wpfTextView.VisualElement.PreviewKeyUp   += VisualElement_PreviewKeyUp;
     wpfTextView.Closed += WpfTextView_Closed;
 }
Example #40
0
 UriMouseProcessorProvider(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IMessageBoxService messageBoxService)
 {
     this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
     this.messageBoxService = messageBoxService;
 }
 public CreateOrderDialogViewModelFactory(IMessageBoxService messageBoxService)
 {
     this.messageBoxService = messageBoxService;
 }
Example #42
0
 CodeBreakpointsOperationsImpl(ICodeBreakpointsVM codeBreakpointsVM, DbgCodeBreakpointDisplaySettings dbgCodeBreakpointDisplaySettings, Lazy <DbgCodeBreakpointsService> dbgCodeBreakpointsService, Lazy <DbgCodeLocationSerializerService> dbgCodeLocationSerializerService, Lazy <ISettingsServiceFactory> settingsServiceFactory, IPickFilename pickFilename, IMessageBoxService messageBoxService, Lazy <ShowCodeBreakpointSettingsService> showCodeBreakpointSettingsService, Lazy <DbgCodeBreakpointSerializerService> dbgCodeBreakpointSerializerService, Lazy <ReferenceNavigatorService> referenceNavigatorService, Lazy <DbgCodeBreakpointHitCountService> dbgCodeBreakpointHitCountService, Lazy <DbgShowNativeCodeService> dbgShowNativeCodeService)
 {
     this.codeBreakpointsVM = codeBreakpointsVM;
     this.dbgCodeBreakpointDisplaySettings = dbgCodeBreakpointDisplaySettings;
     this.dbgCodeBreakpointsService        = dbgCodeBreakpointsService;
     this.dbgCodeLocationSerializerService = dbgCodeLocationSerializerService;
     this.settingsServiceFactory           = settingsServiceFactory;
     this.pickFilename      = pickFilename;
     this.messageBoxService = messageBoxService;
     this.showCodeBreakpointSettingsService  = showCodeBreakpointSettingsService;
     this.dbgCodeBreakpointSerializerService = dbgCodeBreakpointSerializerService;
     this.referenceNavigatorService          = referenceNavigatorService;
     this.dbgCodeBreakpointHitCountService   = dbgCodeBreakpointHitCountService;
     this.dbgShowNativeCodeService           = dbgShowNativeCodeService;
 }
 public FolderSettingsPageViewModel(IWorkbook workbook, INavigationService navigationService, IMessageBoxService messageBoxService)
     : base(workbook, navigationService, messageBoxService)
 {
 }
 public override bool TryValidate(IMessageBoxService messageBoxService)
 {
     return(mValidate());
 }
Example #45
0
 public ImageViewerCommand(IImageViewerService imageViewerService, IMessageBoxService messageBoxService)
 {
     ImageViewerService = imageViewerService;
     MessageBoxService  = messageBoxService;
 }
Example #46
0
        public static async Task CheckWarningBeforeSync(IWorkbook workbook, ISynchronizationManager syncManager, IMessageBoxService messageBoxService, IPlatformService platformService)
        {
            if (workbook == null)
            {
                throw new ArgumentNullException("workbook");
            }
            if (syncManager == null)
            {
                throw new ArgumentNullException("syncManager");
            }
            if (messageBoxService == null)
            {
                throw new ArgumentNullException("messageBoxService");
            }
            if (platformService == null)
            {
                throw new ArgumentNullException("platformService");
            }

            // check if context warning has already been shown
            if (!workbook.Settings.GetValue <bool>(CoreSettings.SyncWarningContextNotSupported))
            {
                if (workbook.Contexts.Count > 0 && !syncManager.ActiveProviderSupportFeature(SyncFeatures.Context))
                {
                    // show warning
                    var result = await messageBoxService.ShowAsync(
                        StringResources.Dialog_TitleConfirmation,
                        StringResources.Dialog_SyncContextsNotSupported,
                        DialogButton.YesNo);

                    if (result == DialogResult.Yes)
                    {
                        await platformService.OpenWebUri(Constants.HelpPageChooseSyncAddress);
                    }

                    workbook.Settings.SetValue(CoreSettings.SyncWarningContextNotSupported, true);
                }
            }
        }
        public WizardStyleViewModelBase(
            IMessageBoxService messageBoxService,
            ICoreSourceSettings coreSourceSettings,
            ISourceSqlUpdateService sqlUpdateService,
            IAuthMySqlExecutor authExecutor,
            IMySqlExecutor worldExecutor,
            IWindowManager windowManager,
            ITaskRunner taskRunner,
            IStatusBar statusBar,
            INativeTextDocument resultCode)
        {
            ResultCode       = resultCode;
            CoreSourceFolder = coreSourceSettings.CurrentCorePath;
            if (!string.IsNullOrEmpty(coreSourceSettings.CurrentCorePath))
            {
                Dispatcher.UIThread.Post(() => WizardStep++);
            }

            CommandPreviousStep = new DelegateCommand(() => WizardStep--, () => !IsLoading && WizardStep > 0)
                                  .ObservesProperty(() => IsLoading)
                                  .ObservesProperty(() => WizardStep);

            CommandNextStep = new DelegateCommand(() => WizardStep++, () => !IsLoading && WizardStep < TotalSteps - 1)
                              .ObservesProperty(() => IsLoading)
                              .ObservesProperty(() => WizardStep);

            PickCoreSourceFolder = new AsyncAutoCommand(async() =>
            {
                var selectedPath = await windowManager.ShowFolderPickerDialog(coreSourceFolder);
                if (selectedPath != null)
                {
                    if (!coreSourceSettings.SetCorePath(selectedPath))
                    {
                        await messageBoxService.ShowDialog(new MessageBoxFactory <bool>()
                                                           .SetTitle("Invalid folder")
                                                           .SetMainInstruction("Invalid wow source folder")
                                                           .SetContent(
                                                               "It looks like it is not an valid wow server source folder.\n\nThe folder should contain src/ and sql/ subfolders")
                                                           .WithOkButton(true)
                                                           .Build());
                    }
                    CoreSourceFolder = coreSourceSettings.CurrentCorePath;
                }
            });

            ExecuteSqlCommand = new AsyncAutoCommand(async() =>
            {
                var(auth, world) = GenerateSql();
                try
                {
                    await taskRunner.ScheduleTask("Executing commands update", async() =>
                    {
                        statusBar.PublishNotification(new PlainNotification(NotificationType.Info, "Executing query"));
                        if (auth != null)
                        {
                            if (authExecutor.IsConnected)
                            {
                                await authExecutor.ExecuteSql(auth);
                            }
                            else
                            {
                                await messageBoxService.ShowDialog(new MessageBoxFactory <bool>()
                                                                   .SetTitle("Auth database not connected")
                                                                   .SetIcon(MessageBoxIcon.Warning)
                                                                   .SetMainInstruction("Auth database not connected")
                                                                   .SetContent(
                                                                       "You are trying to execute auth query, but auth database is not connected.\n\nEnsure you have correct auth database data in settings.")
                                                                   .WithOkButton(true)
                                                                   .Build());
                            }
                        }

                        if (world != null)
                        {
                            if (worldExecutor.IsConnected)
                            {
                                await worldExecutor.ExecuteSql(world);
                            }
                            else
                            {
                                await messageBoxService.ShowDialog(new MessageBoxFactory <bool>()
                                                                   .SetTitle("World database not connected")
                                                                   .SetIcon(MessageBoxIcon.Warning)
                                                                   .SetMainInstruction("World database not connected")
                                                                   .SetContent(
                                                                       "You are trying to execute world query, but world database is not connected.\n\nEnsure you have correct world database data in settings.")
                                                                   .WithOkButton(true)
                                                                   .Build());
                            }
                        }

                        statusBar.PublishNotification(new PlainNotification(NotificationType.Success,
                                                                            "Executed query"));
                    });
                }
                catch (Exception)
                {
                    statusBar.PublishNotification(new PlainNotification(NotificationType.Error, "Error while executing query. Check Database Query Debug window"));
                }
            }, _ => worldExecutor.IsConnected || authExecutor.IsConnected);

            SaveSqlCommand = new AsyncAutoCommand(async() =>
            {
                var(auth, world) = GenerateSql();

                if (auth != null)
                {
                    sqlUpdateService.SaveAuthUpdate(SqlSuffixName, auth);
                }

                if (world != null)
                {
                    sqlUpdateService.SaveWorldUpdate(SqlSuffixName, world);
                }

                if (auth != null || world != null)
                {
                    await messageBoxService.ShowDialog(new MessageBoxFactory <bool>()
                                                       .SetTitle("Done!")
                                                       .SetContent("SQL files saved to sql/updates/")
                                                       .SetIcon(MessageBoxIcon.Information)
                                                       .WithOkButton(true)
                                                       .Build());
                }
            });
        }
Example #48
0
        public AdvancedSyncSettingsPageViewModel(IWorkbook workbook, ISynchronizationManager synchronizationManager, IPlatformService platformService, IMessageBoxService messageBoxService, INavigationService navigationService, INotificationService notificationService)
            : base(workbook, navigationService)
        {
            if (synchronizationManager == null)
            {
                throw new ArgumentNullException(nameof(synchronizationManager));
            }
            if (platformService == null)
            {
                throw new ArgumentNullException(nameof(platformService));
            }
            if (messageBoxService == null)
            {
                throw new ArgumentNullException(nameof(messageBoxService));
            }
            if (notificationService == null)
            {
                throw new ArgumentNullException(nameof(notificationService));
            }

            this.synchronizationManager = synchronizationManager;
            this.platformService        = platformService;
            this.messageBoxService      = messageBoxService;
            this.navigationService      = navigationService;
            this.notificationService    = notificationService;
            this.items = new ObservableCollection <AdvancedSyncModeItem>
            {
                new AdvancedSyncModeItem(
                    StringResources.SyncAdvanced_ReplaceTitle,
                    StringResources.SyncAdvanced_ReplaceDescription,
                    ResourcesLocator.SyncAdvancedModeReplace,
                    () => this.ReplaceAsync()),
                new AdvancedSyncModeItem(
                    StringResources.About_Help,
                    StringResources.Sync_FixProblems,
                    ResourcesLocator.SyncAdvancedModeDiag,
                    () => this.OpenSyncHelp()),
                new AdvancedSyncModeItem(
                    StringResources.SyncAdvanced_DiagnosticsTitle,
                    StringResources.SyncAdvanced_DiagnosticsDescription,
                    ResourcesLocator.SyncAdvancedModeDiag,
                    () => this.Diag()),
            };

            if (this.SynchronizationManager.ActiveProvider != null && this.SynchronizationManager.ActiveProvider.CanDeleteAccount)
            {
                this.items.Add(new AdvancedSyncModeItem(
                                   StringResources.SyncAdvanced_DeleteAccountTitle,
                                   StringResources.SyncAdvanced_DeleteAccountDescription,
                                   ResourcesLocator.SyncAdvancedModeDelete,
                                   () => this.Delete()));
            }
        }
 public ShowTwitterStatusCommand(IMessageBoxService messageBoxService)
 {
     MessageBoxService = messageBoxService;
 }
Example #50
0
 public File(ReadOnlyCollection <IProperty> container, IMessageBoxService messageBoxService)
     : base(container, GridLength.Auto)
 {
     Open = new Command(OpenFile);
     mMessageBoxService = messageBoxService;
 }
Example #51
0
 public LoginViewModel(INavigationService navigationService, IMessageBoxService messageBoxService, IStravaService stravaService) : base(navigationService)
 {
     _stravaService     = stravaService;
     _messageBoxService = messageBoxService;
 }
Example #52
0
 OpenIssuesUrlCommand(IMessageBoxService messageBoxService) => this.messageBoxService = messageBoxService;
Example #53
0
 OpenReleasesUrlCommand(IMessageBoxService messageBoxService) => this.messageBoxService = messageBoxService;
        public MainViewModel(IViewService viewService, IPersistor persistor, IDirtyService dirtyService, IMessageBoxService messageBoxService)
        {
            _viewService       = viewService;
            _persistor         = persistor;
            _dirtyService      = dirtyService;
            _messageBoxService = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));

            SaveCommand   = new RelayCommand(() => Save(), CanSave);
            SaveAsCommand = new RelayCommand(() => SaveAs());
            OpenCommand   = new RelayCommand(Open);
            NewCommand    = new RelayCommand(New);
            EditCommand   = new RelayCommand <StateMachineReferenceViewModel>(Edit);
            AboutCommand  = new RelayCommand(About);

            _dirtyService.PropertyChanged += DirtyService_PropertyChanged;

            New();
            MessengerInstance.Register <SaveMessage>(this, Save);
        }
        protected MiscSettingsPageViewModelBase(IWorkbook workbook, INavigationService navigationService, IMessageBoxService messageBoxService, INotificationService notificationService, IPlatformService platformService, ITrackingManager trackingManager, IPersistenceLayer persistenceLayer) : base(workbook, navigationService)
        {
            if (messageBoxService == null)
            {
                throw new ArgumentNullException(nameof(messageBoxService));
            }
            if (notificationService == null)
            {
                throw new ArgumentNullException(nameof(notificationService));
            }
            if (platformService == null)
            {
                throw new ArgumentNullException(nameof(platformService));
            }
            if (trackingManager == null)
            {
                throw new ArgumentNullException(nameof(trackingManager));
            }
            if (persistenceLayer == null)
            {
                throw new ArgumentNullException(nameof(persistenceLayer));
            }

            this.messageBoxService   = messageBoxService;
            this.notificationService = notificationService;
            this.platformService     = platformService;
            this.trackingManager     = trackingManager;
            this.persistenceLayer    = persistenceLayer;

            this.languages = new List <string> {
                " "
            };
            this.languages.AddRange(SupportedCultures.Languages);

            this.clearSearchHistoryCommand   = new RelayCommand(this.ClearSearchHistoryExecute);
            this.openWelcomeScreenCommand    = new RelayCommand(this.OpenWelcomeScreenExecute);
            this.deleteAllCommand            = new RelayCommand(this.DeleteAllExecute);
            this.deleteTasksCommand          = new RelayCommand(this.DeleteTasksExecute);
            this.deleteCompletedTasksCommand = new RelayCommand(this.DeleteCompletedTasksExecute);
            this.completeTasksCommand        = new RelayCommand(this.CompleteTasksExecute);
            this.createBackupCommand         = new RelayCommand(this.CreateBackupExecute);
            this.restoreBackupCommand        = new RelayCommand(this.RestoreBackupExecute);
            this.sortFoldersCommand          = new RelayCommand(() => this.SortElements(SortType.Folders));
            this.sortSmartViewsCommands      = new RelayCommand(() => this.SortElements(SortType.SmartViews));
            this.sortContextsCommand         = new RelayCommand(() => this.SortElements(SortType.Contexts));
            this.sortTagsCommand             = new RelayCommand(() => this.SortElements(SortType.Tags));

            string language = this.Workbook.Settings.GetValue <string>(CoreSettings.OverrideLanguage);

            if (!string.IsNullOrEmpty(language))
            {
                this.selectedLanguage = SupportedCultures.GetLanguageNameFromCode(language);
                this.previousLanguage = this.selectedLanguage;
            }

            this.sendAnalytics = this.Workbook.Settings.GetValue <bool>(CoreSettings.SendAnalytics);
        }
Example #56
0
 OpenWikiUrlCommand(IMessageBoxService messageBoxService) => this.messageBoxService = messageBoxService;
Example #57
0
        public CustomActionManager(MacroManagerViewModel macroManager, ViewModelFactory viewModelFactory, DataIO dataIO, IMessageBoxService messageBoxService)
        {
            this.macroManager      = macroManager;
            this.viewModelFactory  = viewModelFactory;
            this.dataIO            = dataIO;
            this.messageBoxService = messageBoxService;

            LoadDefault();
            LoadCustomActionList(this.savedCustomAction);
            InitializeCommands();
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="lastAuth">Last.fm authentication object.</param>
 /// <param name="messageBoxService">Service for showing MessageBoxes.</param>
 public LoginViewModel(ILastAuth lastAuth, IMessageBoxService messageBoxService)
 {
     _lastAuth          = lastAuth;
     _messageBoxService = messageBoxService;
     EnableControls     = true;
 }
Example #59
0
 OpenSourceCodeUrlCommand(IMessageBoxService messageBoxService) => this.messageBoxService = messageBoxService;
Example #60
0
        BookmarksContent(IWpfCommandService wpfCommandService, IBookmarksVM bookmarksVM, BookmarksOperations bookmarksOperations, IMessageBoxService messageBoxService)
        {
            Operations                   = bookmarksOperations;
            bookmarksControl             = new BookmarksControl();
            this.bookmarksVM             = bookmarksVM;
            bookmarksControl.DataContext = new ControlVM(bookmarksVM, bookmarksOperations, messageBoxService, bookmarksControl);
            bookmarksControl.BookmarksListViewDoubleClick += BookmarksControl_BookmarksListViewDoubleClick;

            wpfCommandService.Add(ControlConstants.GUID_BOOKMARKS_CONTROL, bookmarksControl);
            wpfCommandService.Add(ControlConstants.GUID_BOOKMARKS_LISTVIEW, bookmarksControl.ListView);

            bookmarksControl.ListView.PreviewKeyDown += ListView_PreviewKeyDown;
        }