Example #1
0
 public SourceExplorerHierarchyControllerFactory(
     ISynchronizationContextProvider synchronizationContextProvider,
     IFileSystemTreeSource fileSystemTreeSource,
     IVisualStudioPackageProvider visualStudioPackageProvider,
     IVsGlyphService vsGlyphService,
     IImageSourceFactory imageSourceFactory,
     IOpenDocumentHelper openDocumentHelper,
     IFileSystem fileSystem,
     IClipboard clipboard,
     IWindowsExplorer windowsExplorer,
     IDispatchThreadServerRequestExecutor dispatchThreadServerRequestExecutor,
     IEventBus eventBus,
     IGlobalSettingsProvider globalSettingsProvider,
     IDelayedOperationExecutor delayedOperationExecutor,
     IDispatchThread dispatchThread,
     IShowServerInfoService showServerInfoService)
 {
     _synchronizationContextProvider = synchronizationContextProvider;
     _fileSystemTreeSource           = fileSystemTreeSource;
     _visualStudioPackageProvider    = visualStudioPackageProvider;
     _vsGlyphService     = vsGlyphService;
     _imageSourceFactory = imageSourceFactory;
     _openDocumentHelper = openDocumentHelper;
     _fileSystem         = fileSystem;
     _clipboard          = clipboard;
     _windowsExplorer    = windowsExplorer;
     _dispatchThreadServerRequestExecutor = dispatchThreadServerRequestExecutor;
     _eventBus = eventBus;
     _globalSettingsProvider   = globalSettingsProvider;
     _delayedOperationExecutor = delayedOperationExecutor;
     _dispatchThread           = dispatchThread;
     _showServerInfoService    = showServerInfoService;
 }
Example #2
0
        public MainViewModel(
            IDataApiClient dataApiClient,
            DataVisualizer dataVisualizer,
            IReadonlyObjectDatabase <UserProfile> userDatabase,
            IReadonlyObjectDatabase <DataSet> dataSetDatabase,
            IReadonlyObjectDatabase <DataProject> dataProjectDatabase,
            IClipboard clipboard,
            IClosable mainWindow)
        {
            this.dataApiClient       = dataApiClient;
            this.userDatabase        = userDatabase;
            this.mainWindow          = mainWindow;
            DataSetMainViewModel     = new DataSetMainViewModel(dataApiClient, dataSetDatabase, dataProjectDatabase, clipboard);
            CollectionsMainViewModel = new CollectionsMainViewModel(dataApiClient, dataVisualizer, userDatabase, clipboard);

            var passwordBoxSpawner = new WpfPasswordBoxSpawner();
            var loginViewSpawner   = new WpfWindowSpawner <LoginViewModel>(vm => new LoginWindow {
                ViewModel = vm
            });
            var changePasswordViewSpawner = new WpfWindowSpawner <ChangePasswordViewModel>(vm => new ChangePasswordWindow {
                ViewModel = vm
            });

            UserSwitchViewModel = new UserSwitchViewModel(
                dataApiClient,
                LoginSuccessful,
                LoginFailed,
                passwordBoxSpawner,
                loginViewSpawner,
                changePasswordViewSpawner);
            OpenUserManagementWindowCommand = new RelayCommand(OpenUserManagementWindow);
            OpenAboutWindowCommand          = new RelayCommand(OpenAboutWindow);
        }
 public XmlMessageViewModel(
     IContentDecoder <XmlDocument> xmlDecoder,
     IClipboard clipboard)
 {
     _xmlDecoder = xmlDecoder;
     _clipboard  = clipboard;
 }
        public MessageFlowViewModel(
            IServiceControl serviceControl,
            IEventAggregator eventAggregator,
            IWindowManagerEx windowManager,
            SearchBarViewModel searchBar,
            MessageListViewModel messageList,
            Func <ExceptionDetailViewModel> exceptionDetail,
            ISettingsProvider settingsProvider,
            EndpointExplorerViewModel endpointExplorer,
            IClipboard clipboard)
        {
            this.serviceControl   = serviceControl;
            this.eventAggregator  = eventAggregator;
            this.windowManager    = windowManager;
            this.settingsProvider = settingsProvider;
            this.messageList      = messageList;
            this.endpointExplorer = endpointExplorer;
            this.exceptionDetail  = exceptionDetail;

            CopyConversationIDCommand = new CopyConversationIDCommand(clipboard);
            CopyMessageURICommand     = new CopyMessageURICommand(clipboard, serviceControl);
            SearchByMessageIDCommand  = new SearchByMessageIDCommand(eventAggregator, searchBar);
            RetryMessageCommand       = new RetryMessageCommand(eventAggregator, serviceControl);

            Diagram = new MessageFlowDiagram();
            nodeMap = new ConcurrentDictionary <string, MessageNode>();
        }
        public MessageListViewModel(
            IEventAggregator eventAggregator,
            IWorkNotifier workNotifier,
            IServiceControl serviceControl,
            SearchBarViewModel searchBarViewModel,
            GeneralHeaderViewModel generalHeaderDisplay,
            MessageSelectionContext selectionContext,
            IClipboard clipboard,
            ISettingsProvider settingsProvider)
        {
            SearchBar = searchBarViewModel;
            Selection = selectionContext;

            this.clipboard            = clipboard;
            this.settingsProvider     = settingsProvider;
            this.eventAggregator      = eventAggregator;
            this.workNotifier         = workNotifier;
            this.serviceControl       = serviceControl;
            this.generalHeaderDisplay = generalHeaderDisplay;

            Items.Add(SearchBar);

            RetryMessageCommand  = new RetryMessageCommand(eventAggregator, workNotifier, serviceControl);
            CopyMessageIdCommand = new CopyMessageURICommand(clipboard, serviceControl);
            CopyHeadersCommand   = Command.Create(CopyHeaders,
                                                  generalHeaderDisplay.Changed
                                                  .Where(pc => pc.PropertyName == nameof(GeneralHeaderViewModel.HeaderContent))
                                                  .Select(s => !((string)s.Value).IsEmpty()));
            Rows = new BindableCollection <StoredMessage>();
        }
        public MessageListViewModel(
            IEventAggregator eventAggregator,
            IServiceControl serviceControl,
            ISearchBarViewModel searchBarViewModel,
            IErrorHeaderViewModel errorHeaderDisplay,
            IGeneralHeaderViewModel generalHeaderDisplay,
            IClipboard clipboard)
        {
            _eventAggregator      = eventAggregator;
            _serviceControl       = serviceControl;
            _errorHeaderDisplay   = errorHeaderDisplay;
            _generalHeaderDisplay = generalHeaderDisplay;
            _clipboard            = clipboard;

            SearchBar = searchBarViewModel;
            Items.Add(SearchBar);

            _returnToSourceMenu = new MenuItem("Return To Source", new RelayCommand(ReturnToSource, CanReturnToSource), Properties.Resources.MessageReturn);
            _retryMessageMenu   = new MenuItem("Retry Message", new RelayCommand(RetryMessage, CanRetryMessage), Properties.Resources.MessageReturn);
            _copyMessageIdMenu  = new MenuItem("Copy Message URI", new RelayCommand(CopyMessageId, CanCopyMessageId));
            _copyHeadersMenu    = new MenuItem("Copy Headers", new RelayCommand(CopyHeaders, CanCopyHeaders));

            Rows             = new BindableCollection <StoredMessage>();
            ContextMenuItems = new BindableCollection <IMenuItem>
            {
                _returnToSourceMenu,
                _retryMessageMenu,
                _copyHeadersMenu,
                _copyMessageIdMenu
            };
        }
        public MessageListViewModel(
            IEventAggregator eventAggregator,
            IWindowManagerEx windowManager,
            IServiceControl serviceControl,
            IQueueManagerAsync asyncQueueManager,
            ISearchBarViewModel searchBarViewModel,
            IErrorHeaderViewModel errorHeaderDisplay,
            IGeneralHeaderViewModel generalHeaderDisplay,
            IClipboard clipboard,
            IStatusBarManager statusBar)
        {
            _eventAggregator      = eventAggregator;
            _windowManager        = windowManager;
            _serviceControl       = serviceControl;
            _asyncQueueManager    = asyncQueueManager;
            _errorHeaderDisplay   = errorHeaderDisplay;
            _generalHeaderDisplay = generalHeaderDisplay;
            _clipboard            = clipboard;
            _statusBar            = statusBar;

            SearchBar = searchBarViewModel;

            Items.Add(SearchBar);
            Messages         = new BindableCollection <MessageInfo>();
            SelectedMessages = new BindableCollection <MessageInfo>();
            ContextMenuItems = new BindableCollection <ContextMenuModel>
            {
                new ContextMenuModel(this, "ReturnToSource", "Return To Source", Properties.Resources.MessageReturn),
                new ContextMenuModel(this, "RetryMessage", "Retry Message", Properties.Resources.MessageReturn),
                new ContextMenuModel(this, "CopyMessageId", "Copy Message Identifier"),
                new ContextMenuModel(this, "CopyHeaders", "Copy Headers")
            };
        }
Example #8
0
 public CopyImageToClipboardCommandHandler(
     ICanvasToBitmapExporter exporter,
     IClipboard clipboard)
 {
     _exporter  = exporter;
     _clipboard = clipboard;
 }
 public SourceExplorerHierarchyControllerFactory(
     ISynchronizationContextProvider synchronizationContextProvider,
     IFileSystemTreeSource fileSystemTreeSource,
     IVisualStudioPackageProvider visualStudioPackageProvider,
     IVsGlyphService vsGlyphService,
     IImageSourceFactory imageSourceFactory,
     IOpenDocumentHelper openDocumentHelper,
     IFileSystem fileSystem,
     IClipboard clipboard,
     IWindowsExplorer windowsExplorer,
     IUIRequestProcessor uiRequestProcessor,
     IEventBus eventBus,
     IGlobalSettingsProvider globalSettingsProvider,
     IDelayedOperationProcessor delayedOperationProcessor,
     IUIThread uiThread)
 {
     _synchronizationContextProvider = synchronizationContextProvider;
     _fileSystemTreeSource           = fileSystemTreeSource;
     _visualStudioPackageProvider    = visualStudioPackageProvider;
     _vsGlyphService            = vsGlyphService;
     _imageSourceFactory        = imageSourceFactory;
     _openDocumentHelper        = openDocumentHelper;
     _fileSystem                = fileSystem;
     _clipboard                 = clipboard;
     _windowsExplorer           = windowsExplorer;
     _uiRequestProcessor        = uiRequestProcessor;
     _eventBus                  = eventBus;
     _globalSettingsProvider    = globalSettingsProvider;
     _delayedOperationProcessor = delayedOperationProcessor;
     _uiThread                  = uiThread;
 }
Example #10
0
 public void Pegar(IClipboard clipboard)
 {
     lock (this)
     {
         clipboard.Pegar(this);
     }
 }
Example #11
0
        /// <summary>
        /// Initializes a new code editor.
        /// </summary>
        public CodeEditorViewModel(AbstractFoldingStrategy foldingStrategy, IHighlightingDefinition highlightingDefinition, IEnumerable <MenuViewModel> snippets,
                                   IClipboard clipboard)
        {
            _clipboard             = clipboard;
            FoldingStrategy        = foldingStrategy;
            HighlightingDefinition = highlightingDefinition;
            Snippets = snippets;
            Options  = new EditorOptions();

            _contentIndex       = Property.New(this, p => p.ContentIndex, OnPropertyChanged);
            _contentIndex.Value = 0;

            _selectionStart  = Property.New(this, p => p.SelectionStart, OnPropertyChanged);
            _selectionLength = Property.New(this, p => p.SelectionLength, OnPropertyChanged);

            _document = Property.New(this, p => p.Document, OnPropertyChanged);

            _scrollOffset = Property.New(this, p => p.ScrollOffset, OnPropertyChanged);

            _isModified = Property.New(this, p => IsModified, OnPropertyChanged);

            UndoCommand = new RelayCommand(() => Document.UndoStack.Undo(), () => Document.UndoStack.CanUndo);
            RedoCommand = new RelayCommand(() => Document.UndoStack.Redo(), () => Document.UndoStack.CanRedo);

            CopyCommand  = new RelayCommand(Copy);
            CutCommand   = new RelayCommand(Cut);
            PasteCommand = new RelayCommand(Paste, () => _clipboard.ContainsText);
        }
        public void DefaultUseCase(IClipboard clipboard,
                                   GherkinPaster sut,
                                   TestEnvironment environment)
        {
            "Given a complete system".Given(() =>
            {
                environment = FakesLibrary.CreateDefaultEnvironment();
                sut = new GherkinPaster(environment);
            });
            "And a gherkin Scenario".And(() =>
            {
                var sb = new StringBuilder();
                sb.AppendLine("Scenario: Testing the gherkin paster");
                sb.AppendLine("Given a line");
                sb.AppendLine("And a line");
                sb.AppendLine("When a line");
                sb.AppendLine("Then a line");
                clipboard = FakesLibrary.CreateShim(sb.ToString());
            });
            "When the gherkin is pasted".When(() => sut.PasteGherkin(clipboard));

            "Then the output should be a method wrapping 4 strings with appropriate extension methods".Then(() => { var expectedOutput = @"[Scenario]
            public void TestingTheGherkinPaster()
            {
            ""Given a line"".Given(() => {});
            ""And a line"".And(() => {});
            ""When a line"".When(() => {});
            ""Then a line"".Then(() => {});
            }
            ";
                                                                                                                      environment.TextWritten.Should()
                                                                                                                                 .Be(expectedOutput);
            });
        }
Example #13
0
        public LoggingPageViewModel(ILogView logView, IClipboard <ILogView> clipboard, IMailClient <ILogView> mailClient)
        {
            LogView = logView;

            SendCommand = new DelegateCommand(() => mailClient.SendAsync(LogView));
            CopyCommand = new DelegateCommand(() => clipboard.Copy(LogView));
        }
Example #14
0
        public static List <DataObjectViewModel> BuildItems(
            List <JObject> searchResults,
            bool includeMetadata,
            string dataType,
            IDataApiClient dataApiClient,
            IClipboard clipboard,
            ICollectionSwitcher collectionSwitcher,
            Action <DataObjectViewModel> deleteCallback)
        {
            var dataObjects          = new List <DataObjectViewModel>();
            var jsonViewModelFactory = new JsonViewModelFactory(clipboard, collectionSwitcher);

            foreach (var jObject in searchResults)
            {
                var    id   = jObject.ContainsKey("_id") ? jObject["_id"].Value <string>() : null;
                JToken data = jObject;
                if (!includeMetadata && jObject.ContainsKey("Data"))
                {
                    data = jObject["Data"];
                }
                if (!(jsonViewModelFactory.Create(data) is JObjectViewModel jObjectViewModel))
                {
                    continue;
                }
                var dataObject = new DataObjectViewModel(jObjectViewModel, dataType, id, dataApiClient, deleteCallback);
                dataObjects.Add(dataObject);
            }
            return(dataObjects);
        }
 public SourceExplorerHierarchyControllerFactory(
   ISynchronizationContextProvider synchronizationContextProvider,
   IFileSystemTreeSource fileSystemTreeSource,
   IVisualStudioPackageProvider visualStudioPackageProvider,
   IVsGlyphService vsGlyphService,
   IImageSourceFactory imageSourceFactory,
   IOpenDocumentHelper openDocumentHelper,
   IFileSystem fileSystem,
   IClipboard clipboard,
   IWindowsExplorer windowsExplorer,
   IUIRequestProcessor uiRequestProcessor,
   IEventBus eventBus,
   IGlobalSettingsProvider globalSettingsProvider,
   IDelayedOperationProcessor delayedOperationProcessor,
   IUIThread uiThread) {
   _synchronizationContextProvider = synchronizationContextProvider;
   _fileSystemTreeSource = fileSystemTreeSource;
   _visualStudioPackageProvider = visualStudioPackageProvider;
   _vsGlyphService = vsGlyphService;
   _imageSourceFactory = imageSourceFactory;
   _openDocumentHelper = openDocumentHelper;
   _fileSystem = fileSystem;
   _clipboard = clipboard;
   _windowsExplorer = windowsExplorer;
   _uiRequestProcessor = uiRequestProcessor;
   _eventBus = eventBus;
   _globalSettingsProvider = globalSettingsProvider;
   _delayedOperationProcessor = delayedOperationProcessor;
   _uiThread = uiThread;
 }
        public MessageListViewModel(
            IEventAggregator eventAggregator,
            IServiceControl serviceControl,
            SearchBarViewModel searchBarViewModel,
            GeneralHeaderViewModel generalHeaderDisplay,
            IClipboard clipboard)
        {
            this.clipboard            = clipboard;
            this.eventAggregator      = eventAggregator;
            this.serviceControl       = serviceControl;
            this.generalHeaderDisplay = generalHeaderDisplay;

            SearchBar = searchBarViewModel;
            Items.Add(SearchBar);

            RetryMessageCommand  = new RetryMessageCommand(eventAggregator, serviceControl);
            CopyMessageIdCommand = new CopyMessageURICommand(clipboard, serviceControl);

            CopyHeadersCommand = this.CreateCommand(CopyHeaders, generalHeaderDisplay.WhenAnyValue(ghd => ghd.HeaderContent).Select(s => !s.IsEmpty()));

            Rows = new BindableCollection <StoredMessage>();

            this.WhenAnyValue(vm => vm.FocusedRow)
            .Throttle(TimeSpan.FromMilliseconds(500), RxApp.MainThreadScheduler)
            .Subscribe(_ => DoFocusedRowChanged());
        }
 public XmlMessageViewModel(
     IContentDecoder<XmlDocument> xmlDecoder,
     IClipboard clipboard)
 {
     _xmlDecoder = xmlDecoder;
     _clipboard = clipboard;
 }
Example #18
0
        public CodeSearchController(
            CodeSearchControl control,
            IDispatchThreadServerRequestExecutor dispatchThreadServerRequestExecutor,
            IDispatchThreadDelayedOperationExecutor dispatchThreadDelayedOperationExecutor,
            IFileSystemTreeSource fileSystemTreeSource,
            ITypedRequestProcessProxy typedRequestProcessProxy,
            IProgressBarTracker progressBarTracker,
            IStandarImageSourceFactory standarImageSourceFactory,
            IWindowsExplorer windowsExplorer,
            IClipboard clipboard,
            ISynchronizationContextProvider synchronizationContextProvider,
            IOpenDocumentHelper openDocumentHelper,
            ITextDocumentTable textDocumentTable,
            IEventBus eventBus,
            IGlobalSettingsProvider globalSettingsProvider,
            IBuildOutputParser buildOutputParser,
            IVsEditorAdaptersFactoryService adaptersFactoryService,
            IShowServerInfoService showServerInfoService)
        {
            _control = control;
            _dispatchThreadServerRequestExecutor = dispatchThreadServerRequestExecutor;
            _fileSystemTreeSource      = fileSystemTreeSource;
            _typedRequestProcessProxy  = typedRequestProcessProxy;
            _progressBarTracker        = progressBarTracker;
            _standarImageSourceFactory = standarImageSourceFactory;
            _windowsExplorer           = windowsExplorer;
            _clipboard = clipboard;
            _synchronizationContextProvider = synchronizationContextProvider;
            _openDocumentHelper             = openDocumentHelper;
            _eventBus = eventBus;
            _globalSettingsProvider            = globalSettingsProvider;
            _buildOutputParser                 = buildOutputParser;
            _adaptersFactoryService            = adaptersFactoryService;
            _showServerInfoService             = showServerInfoService;
            _searchResultDocumentChangeTracker = new SearchResultsDocumentChangeTracker(
                dispatchThreadDelayedOperationExecutor,
                textDocumentTable);
            _taskCancellation = new TaskCancellation();

            // Ensure initial values are in sync.
            GlobalSettingsOnPropertyChanged(null, null);

            // Ensure changes to ViewModel are synchronized to global settings
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;

            // Ensure changes to global settings are synchronized to ViewModel
            _globalSettingsProvider.GlobalSettings.PropertyChanged += GlobalSettingsOnPropertyChanged;

            _eventBusCookie1 = _eventBus.RegisterHandler("TextDocument-Open", TextDocumentOpenHandler);
            _eventBusCookie2 = _eventBus.RegisterHandler("TextDocument-Closed", TextDocumentClosedHandler);
            _eventBusCookie3 = _eventBus.RegisterHandler("TextDocumentFile-FileActionOccurred", TextDocumentFileActionOccurred);

            typedRequestProcessProxy.EventReceived += TypedRequestProcessProxy_OnEventReceived;

            dispatchThreadServerRequestExecutor.ProcessFatalError += DispatchThreadServerRequestExecutor_OnProcessFatalError;

            fileSystemTreeSource.TreeReceived  += FileSystemTreeSource_OnTreeReceived;
            fileSystemTreeSource.ErrorReceived += FileSystemTreeSource_OnErrorReceived;
        }
Example #19
0
 public static string GetContents()
 {
     if (_instance == null)
     {
         _instance = new Clipboard();
     }
     return(_instance.GetContents());
 }
Example #20
0
        public void Initialize(string resourceDirectory, IClipboard clipboard)
        {
            System = new System(clipboard);
            ResourceManager = new ResourceManager();
            MusicPlayer = new MusicPlayer();

            DriverLoader.AddEnvironmentPaths(new string[] { global::System.IO.Path.GetFullPath(resourceDirectory + "/drivers/x86/sdl") });
        }
Example #21
0
        public ClipboardFilesRepository([NotNull] INotifyOfClipboardUpdates clipUpdater, [NotNull] IClipboard clipboard)
        {
            Debug.Assert(clipUpdater != null, nameof(clipUpdater) + " != null");
            Debug.Assert(clipboard != null, nameof(clipboard) + " != null");

            m_clipUpdater = clipUpdater;
            m_clipboard   = clipboard;
        }
Example #22
0
 public void TestInitialize()
 {
     XmlDecoder = Substitute.For <IContentDecoder <XmlDocument> >();
     Clipboard  = Substitute.For <IClipboard>();
     View       = Substitute.For <IXmlMessageView>();
     ViewModel  = new XmlMessageViewModel(XmlDecoder, Clipboard);
     ViewModel.Activate();
 }
        public HistoryListItemViewModel(ContentBase content, IClipboard clipboard) : this()
        {
            _content = content;

            CopyToClipboardCommand = ReactiveCommand.Create(() => { content.SetToClipboard(clipboard); });

            Update();
        }
Example #24
0
 public void Copiar(IClipboard clipboard)
 {
     lock (this)
     {
         Seleccion sel = conttexto.ObtenerSeleccion();
         clipboard.Copiar(sel);
     }
 }
Example #25
0
 public static void SetContents(string text)
 {
     if (_instance == null)
     {
         _instance = new Clipboard();
     }
     _instance.SetContents(text);
 }
 public RichTextEditInteractionElement(IRichTextComponent cText,
                                       IInputHandler inputHandler, IUndoRedoService undoRedo, IClipboard clipboard)
 {
     this.cText        = cText;
     this.undoRedo     = undoRedo;
     this.clipboard    = clipboard;
     this.inputHandler = inputHandler;
 }
Example #27
0
 public DataObjectLoader(
     IDataApiClient dataApiClient,
     IClipboard clipboard,
     ICollectionSwitcher collectionSwitcher)
 {
     this.dataApiClient   = dataApiClient;
     jsonViewModelFactory = new JsonViewModelFactory(clipboard, collectionSwitcher);
 }
Example #28
0
        //=========================================================================================
        internal bool CopyToClipboard(bool deleteSelection)
        {
            if (!this.HasSelection())
            {
                return(false);
            }

            //Determine start and end of selection
            TextPoint pStart, pEnd;

            if (this.SelectionStart > this.CurPos)
            {
                pStart = this.CurPos;
                pEnd   = this.SelectionStart;
            }
            else
            {
                pStart = this.SelectionStart;
                pEnd   = this.CurPos;
            }

            var sb = new StringBuilder();

            if (pStart.Line == pEnd.Line)
            {
                string sLine = this.Doc[pStart.Line].Text;
                sb.Append(sLine.Substring(pStart.Char, pEnd.Char - pStart.Char));
            }
            else
            {
                //first line
                sb.AppendLine(this.Doc[pStart.Line].Text.Substring(pStart.Char));
                //intermediate lines
                for (int iLine = pStart.Line + 1; iLine < pEnd.Line; iLine++)
                {
                    sb.AppendLine(this.Doc[iLine].Text);
                }
                //last line
                string sLastLine = this.Doc[pEnd.Line].Text;
                if (pEnd.Char < sLastLine.Length)
                {
                    sLastLine = sLastLine.Remove(pEnd.Char);
                }
                sb.Append(sLastLine);
            }
            if (this.ClipboardProxy == null)
            {
                this.ClipboardProxy = ClipboardProxyClass.Self;
            }
            try { this.ClipboardProxy.SetText(sb.ToString()); }
            catch (System.Runtime.InteropServices.ExternalException) { }

            if (deleteSelection)
            {
                this.DeleteSelection();
            }
            return(true);
        }
Example #29
0
        public VirtualEntryLine(IConsole console, IClipboard clipboard, ConsoleFontColor cmdColor)
        {
            console.Requires(nameof(console)).IsNotNull();
            clipboard.Requires(nameof(clipboard)).IsNotNull();

            this._console   = console;
            this._clipboard = clipboard;
            this._cmdColor  = cmdColor;
        }
 public PasswordEntryScreen(
     INavigationService navigationService,
     IEventAggregator eventAggregator,
     IClipboard clipboard,
     IPageServices pageServices) : base(navigationService, eventAggregator, pageServices)
 {
     _navigationService = navigationService;
     _clipboard = clipboard;
 }
Example #31
0
 public SagaHeaderViewModel(
     IEventAggregator eventAggregator,
     IContentDecoder <IList <HeaderInfo> > decoder,
     IQueueManagerAsync queueManager,
     IClipboard clipboard)
     : base(eventAggregator, decoder, queueManager, clipboard)
 {
     DisplayName = "Saga";
 }
Example #32
0
        public ShowCodePageViewModel(BaseServices baseServices, ICodeSampleResolver codeSampleResolver, IClipboard clipboard)
            : base(baseServices)
        {
            CodeSampleResolver = codeSampleResolver;
            Clipboard          = clipboard;

            TapCommand = new DelegateCommand <string>(OnTapCommandExecuted);
            CopyTextToClipboardCommand = new DelegateCommand(OnCopyTextToClipboardCommandExecuted);
        }
Example #33
0
 public GeneralHeaderViewModel(
     IEventAggregator eventAggregator, 
     IContentDecoder<IList<HeaderInfo>> decoder, 
     IQueueManagerAsync queueManager, 
     IClipboard clipboard)
     : base(eventAggregator, decoder, queueManager, clipboard)
 {
     DisplayName = "General";
 }
        public ShowCodePageViewModel(INavigationService navigationService, IPageDialogService pageDialogService, ILogger logger, ICodeSampleResolver codeSampleResolver, IClipboard clipboard)
            : base(navigationService, pageDialogService, logger)
        {
            CodeSampleResolver = codeSampleResolver;
            Clipboard          = clipboard;

            TapCommand = new DelegateCommand <string>(OnTapCommandExecuted);
            CopyTextToClipboardCommand = new DelegateCommand(OnCopyTextToClipboardCommandExecuted);
        }
Example #35
0
        public override void OnFrameworkInitializationCompleted()
        {
            TemplateService = new TemplateService();
            ImageService    = new ImageService();
            Clipboard       = AvaloniaLocator.Current.GetService <IClipboard>();

            // init logger
            Log.Logger = new LoggerConfiguration()
#if DEBUG
                         .ReadFrom.Configuration(Configuration)
#else
                         .WriteTo.Sentry(o =>
            {
                o.Dsn = new Dsn("https://[email protected]/8");
                // Debug and higher are stored as breadcrumbs (default is Information)
                o.MinimumBreadcrumbLevel = LogEventLevel.Information;
                // Warning and higher is sent as event (default is Error)
                o.MinimumEventLevel = LogEventLevel.Error;
            })
#endif
                         .CreateLogger();

            var currenciesProvider = new CurrenciesProvider(CurrenciesConfigurationString);
            var symbolsProvider    = new SymbolsProvider(SymbolsConfiguration);

            // init Atomex client app
            AtomexApp = new AtomexApp()
                        .UseCurrenciesProvider(currenciesProvider)
                        .UseSymbolsProvider(symbolsProvider)
                        .UseCurrenciesUpdater(new CurrenciesUpdater(currenciesProvider))
                        .UseSymbolsUpdater(new SymbolsUpdater(symbolsProvider))
                        .UseQuotesProvider(new BitfinexQuotesProvider(
                                               currencies: currenciesProvider.GetCurrencies(Network.MainNet),
                                               baseCurrency: BitfinexQuotesProvider.Usd));

            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
            {
                var mainWindow = new MainWindow();
                DialogService = new DialogService <DialogServiceView>(mainWindow);
                var mainWindowViewModel = new MainWindowViewModel(AtomexApp, mainWindow);

                mainWindow.DataContext = mainWindowViewModel;
                desktop.MainWindow     = mainWindow;

                desktop.Exit += OnExit;

                // var sink = new InMemorySink(mainWindowViewModel.LogEvent);
                // Log.Logger = new LoggerConfiguration()
                //     .WriteTo.Sink(sink)
                //     .CreateLogger();
            }

            AtomexApp.Start();

            base.OnFrameworkInitializationCompleted();
        }
Example #36
0
        private static void InitializeWindows()
        {
            Win32Platform.Initialize();

            PlatformThreadingInterface = Win32Platform.Instance;
            WindowingInterface         = Win32Platform.Instance;
            StandardCursorFactory      = CursorFactory.Instance;
            SystemDialogImplementation = new SystemDialogImpl();
            ClipboardInterface         = new ClipboardImpl();
        }
 public SearchResultsViewModel(
     INavigationService navigationService,
     IEventAggregator eventAggregator,
     IClipboard clipboard,
     IPageServices pageServices,
     IPWDatabaseDataSource dataSource)
     : base(navigationService, eventAggregator, clipboard, pageServices)
 {
     _dataSource = dataSource;
     Results = new ObservableCollection<PwEntry>();
 }
        public LogWindowViewModel(IClipboard clipboard)
        {
            this.clipboard = clipboard;

            Logs = new ReactiveList<LogMessage>();

            textFormatter = new MessageTemplateTextFormatter("{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}", CultureInfo.InvariantCulture);
            LogObserver.SubscribeOn(RxApp.TaskpoolScheduler).Subscribe(UpdateLog);

            ClearCommand = this.CreateCommand(Clear);
            CopyCommand = this.CreateCommand(Copy);
        }
Example #39
0
 protected HeaderInfoViewModelBase(
     IEventAggregator eventAggregator, 
     IContentDecoder<IList<HeaderInfo>> decoder, 
     IQueueManagerAsync queueManager,
     IClipboard clipboard)
 {
     _decoder = decoder;
     _clipboard = clipboard;
     EventAggregator = eventAggregator;
     QueueManager = queueManager;
     Items = new BindableCollection<HeaderInfo>();
 }
Example #40
0
        protected override void Establish_context()
        {
            _clipboard = CreateStub<IClipboard>();
            _specParser = CreateStub<ISpecParser>();
            _cSharpCodeWriter = CreateStub<ICodeWriter>();
            _application = new Application(_clipboard, _specParser, _cSharpCodeWriter);

            var parsedSpec = new ParsedSpec();

            _clipboard.Stub(c => c.GetData()).Return("spec");
            _specParser.Stub(p => p.Parse("spec")).Return(parsedSpec);
            _cSharpCodeWriter.Stub(w => w.WriteCode(parsedSpec)).Return("code");
        }
 public MessagePropertiesViewModel(
     IErrorHeaderViewModel error,
     IGeneralHeaderViewModel general,
     ISagaHeaderViewModel saga,
     IPerformanceHeaderViewModel performance,
     IGatewayHeaderViewModel gateway,
     IClipboard clipboard)
 {
     _clipboard = clipboard;
     Saga = saga;
     Performance = performance;
     Gateway = gateway;
     Errors = error;
     General = general;
 }
 public void PastingDoubleQuotesInScenario(IClipboard clipboard,
                                           GherkinPaster sut,
                                           TestEnvironment environment)
 {
     "Given a complete system".Given(() =>
     {
         environment = FakesLibrary.CreateDefaultEnvironment();
         sut = new GherkinPaster(environment);
     });
     "and a scenario containing a 'double quote'".And(() => clipboard = FakesLibrary.CreateShim("Scenario: With a \" character"));
     "When the single line is pasted".Then(() => sut.PasteGherkin(clipboard));
     "Then the 'double quote' character has been removed".Then(() => environment.LinesWritten.Any(l => l.Contains("\""))
                                                                                .Should()
                                                                                .BeFalse());
 }
 public void SingleLinePaste(IClipboard clipboard,
                             GherkinPaster sut,
                             TestEnvironment environment)
 {
     "Given a complete system".Given(() =>
     {
         environment = FakesLibrary.CreateDefaultEnvironment();
         sut = new GherkinPaster(environment);
     });
     "and a single line of valid gherkin".And(() => clipboard = FakesLibrary.CreateShim("Given a single line"));
     "When the single line is pasted".Then(() => sut.PasteGherkin(clipboard));
     "Then only a single line is received by the environment".Then(() => environment.LinesWritten.Count()
                                                                                    .Should()
                                                                                    .Be(1));
 }
 public MessagePropertiesViewModel(
     ErrorHeaderViewModel error,
     GeneralHeaderViewModel general,
     SagaHeaderViewModel saga,
     PerformanceHeaderViewModel performance,
     GatewayHeaderViewModel gateway,
     IClipboard clipboard)
 {
     Saga = saga;
     Performance = performance;
     Gateway = gateway;
     Errors = error;
     General = general;
     this.clipboard = clipboard;
 }
 public void TestInitialize()
 {
     eventAggregator = Substitute.For<IEventAggregator>();
     workNotifier = Substitute.For<IWorkNotifier>();
     serviceControl = Substitute.For<IServiceControl>();
     searchBar = Substitute.For<SearchBarViewModel>();
     clipboard = Substitute.For<IClipboard>();
     messageListFunc = () => new MessageListViewModel(
         eventAggregator,
         workNotifier,
         serviceControl,
         searchBar,
         Substitute.For<GeneralHeaderViewModel>(),
         Substitute.For<MessageSelectionContext>(),
         clipboard);
 }
        public void PasteGherkin(IClipboard source)
        {
            if (!source.ContainsText())
                return;

            var gherkinText = source.GetText()
                                    .Split(new[] {Environment.NewLine},
                                           StringSplitOptions.RemoveEmptyEntries)
                                    .Select(s => s.Trim());

            var gherkinTree = new GherkinTree(LineGenerators.CSharp,
                                              GWTIdentify);
            gherkinTree.AddLines(gherkinText);

            _environment.Paste(gherkinTree.ToString());
        }
 public void PAstingDoubleQuotesInGWTIClipboard(IClipboard clipboard,
                                                GherkinPaster sut,
                                                TestEnvironment environment)
 {
     "Given a complete system".Given(() =>
     {
         environment = FakesLibrary.CreateDefaultEnvironment();
         sut = new GherkinPaster(environment);
     });
     "and a line containing a 'double quote'".And(() => clipboard = FakesLibrary.CreateShim("Given a \" character"));
     "When the line is pasted".Then(() => sut.PasteGherkin(clipboard));
     "then the 'double quote' character has been replaced by the 'backlash' and 'boudle quote' characters".Then(() =>
     {
         environment.LinesWritten[0].Should()
                                    .Be("\"Given a \\\" character\".Given(() => {});");
     });
 }
 public SourceExplorerViewModelHost(
     SourceExplorerControl control,
     IUIRequestProcessor uiRequestProcessor,
     IStandarImageSourceFactory standarImageSourceFactory,
     IWindowsExplorer windowsExplorer,
     IClipboard clipboard,
     ISynchronizationContextProvider synchronizationContextProvider,
     IOpenDocumentHelper openDocumentHelper)
 {
     _control = control;
       _uiRequestProcessor = uiRequestProcessor;
       _standarImageSourceFactory = standarImageSourceFactory;
       _windowsExplorer = windowsExplorer;
       _clipboard = clipboard;
       _synchronizationContextProvider = synchronizationContextProvider;
       _openDocumentHelper = openDocumentHelper;
 }
        public XmlMessageViewModel(
            IContentDecoder<XmlDocument> xmlDecoder,
            IContentDecoder<string> stringDecoder,
            IClipboard clipboard)
        {
            _xmlDecoder = xmlDecoder;
            _stringDecoder = stringDecoder;
            _clipboard = clipboard;

            //TODO: Add back context menu
//            ContextMenuItems = new List<PluginContextMenu>
//            {
//                new PluginContextMenu("CopyMessageXml", new RelayCommand(CopyMessageXml, CanCopyMessageXml))
//                {
//                    DisplayName = "Copy Message",
//                }
//            };
        }
        private MessageFlowViewModel CreateSUT()
        {
            _serviceControl = Substitute.For<IServiceControl>();
            _eventAggregator = Substitute.For<IEventAggregator>();
            _clipboard = Substitute.For<IClipboard>();
            _windowManager = Substitute.For<IWindowManagerEx>();
            _screenFactory = Substitute.For<IScreenFactory>();
            _searchBar = Substitute.For<ISearchBarViewModel>();
            _messageList = Substitute.For<IMessageListViewModel>();
            _settingProvider = Substitute.For<ISettingsProvider>();
            _endpointExplorer = Substitute.For<IEndpointExplorerViewModel>();

            return new MessageFlowViewModel(_serviceControl,
                                            _eventAggregator,
                                            _clipboard,
                                            _windowManager,
                                            _screenFactory,
                                            _searchBar,
                                            _messageList,
                                            _settingProvider,
                                            _endpointExplorer);
        }
Example #51
0
        public ErrorHeaderViewModel(
            IEventAggregator eventAggregator, 
            IContentDecoder<IList<HeaderInfo>> decoder, 
            IQueueManagerAsync queueManager, 
            IClipboard clipboard)
            : base(eventAggregator, decoder, queueManager, clipboard)
        {
            DisplayName = "Errors";

            //TODO:Add back the context menu
            //            ContextMenuItems.AddRange(new[]
            //            {
            //                new PluginContextMenu("ReturnToSourceQueue", new RelayCommand(ReturnToSource, CanReturnToSource), 90)
            //                {
            //                    DisplayName = "Return To Source Queue",
            //                    Image = Resources.MessageReturn
            //                },
            //                new PluginContextMenu("CopyHeaderInfo", new RelayCommand(CopyHeaderInfo, CanCopyHeaderInfo))
            //                {
            //                    DisplayName = "Copy Header Info",
            //                }
            //            });
        }
 public CopyConversationIDCommand(IClipboard clipboard)
 {
     this.clipboard = clipboard;
 }
 public void TestInitialize()
 {
     StringDecoder = Substitute.For<IContentDecoder<string>>();
     XmlDecoder = Substitute.For<IContentDecoder<XmlDocument>>();
     Clipboard = Substitute.For<IClipboard>();
     View = Substitute.For<IXmlMessageView>();
     ViewModel = new XmlMessageViewModel(XmlDecoder, StringDecoder, Clipboard);
     ViewModel.Activate();
 }
 public CopyMessageURICommand(IClipboard clipboard, IServiceControl serviceControl)
 {
     this.clipboard = clipboard;
     this.serviceControl = serviceControl;
 }
Example #55
0
 public Application(IClipboard clipboard, ISpecParser specParser, ICodeWriter cSharpCodeWriter)
 {
     _clipboard = clipboard;
     _specParser = specParser;
     _codeWriter = cSharpCodeWriter;
 }
Example #56
0
 public System(IClipboard clipboard)
 {
     this.Clipboard = clipboard;
 }
 public void TestInitialize()
 {
     EventAggregator = Substitute.For<IEventAggregator>();
     ServiceControl = Substitute.For<IServiceControl>();
     SearchBar = Substitute.For<SearchBarViewModel>();
     Clipboard = Substitute.For<IClipboard>();
     MessageListFunc = () => new MessageListViewModel(EventAggregator,
                                            ServiceControl,
                                            SearchBar,
                                            Substitute.For<GeneralHeaderViewModel>(),
                                            Clipboard);
 }
Example #58
0
 public System(IClipboard clipboard)
 {
     stopwatch = new Stopwatch();
     this.Clipboard = clipboard;
 }
 public SelectableTextBoxEditor()
 {
     _clipboard = new WpfClipboard();
 }
 public void TestInitialize()
 {
     clipboard = Substitute.For<IClipboard>();
     viewModel = new LogWindowViewModel(clipboard);
 }