public FileSearchDialogViewModel(MainViewModel mainViewModel)
 {
     m_mainViewModel = mainViewModel;
       m_filteredFiles = new FilteredObservableCollection<FileViewModel>(null, n => n.Name.Contains(m_searchString));
       m_showCloseButton = false;
       m_openCommand = new ManualCommand(OpenFile);
       m_changeIndexCommand = new GenericManualCommand<int>(ChangeIndex, null, n => int.Parse((string) n));
 }
 public SpringCompletionSet(string moniker, string displayName, ITrackingSpan applicableTo, IEnumerable<Microsoft.VisualStudio.Language.Intellisense.Completion> completions, IEnumerable<Microsoft.VisualStudio.Language.Intellisense.Completion> completionBuilders)
     : base(moniker, displayName, applicableTo, completions, completionBuilders)
 {
     this._filteredCompletions = new FilteredObservableCollection<Microsoft.VisualStudio.Language.Intellisense.Completion>(this.WritableCompletions);
     this._filteredCompletionBuilders = new FilteredObservableCollection<Microsoft.VisualStudio.Language.Intellisense.Completion>(this.WritableCompletionBuilders);
 }
        /// <summary>
        /// Initializes a new instance with the specified properties.
        /// </summary>
        /// <param name="moniker">The unique, non-localized identifier for the completion set.</param>
        /// <param name="displayName">The localized name of the completion set.</param>
        /// <param name="applicableTo">The tracking span to which the completions apply.</param>
        /// <param name="completions">The list of completions.</param>
        /// <param name="options">The options to use for filtering and selecting items.</param>
        /// <param name="comparer">The comparer to use to order the provided completions.</param>
        /// <param name="matchInsertionText">If true, matches user input against
        /// the insertion text; otherwise, uses the display text.</param>
        public FuzzyCompletionSet(
            string moniker,
            string displayName,
            ITrackingSpan applicableTo,
            IEnumerable<DynamicallyVisibleCompletion> completions,
            IComparer<Completion> comparer,
            bool matchInsertionText = false
        ) :
            base(moniker, displayName, applicableTo, null, null) {
            _matchInsertionText = matchInsertionText;
            _completions = new BulkObservableCollection<Completion>();
            _completions.AddRange(completions
                .Where(c => c != null && !string.IsNullOrWhiteSpace(c.DisplayText))
                .OrderBy(c => c, comparer)
            );
            _comparer = new FuzzyStringMatcher(FuzzyMatchMode.Default);

#if FALSE
            _shouldFilter = options.FilterCompletions;
            _shouldHideAdvanced = options.HideAdvancedMembers && !_completions.All(IsAdvanced);
#endif
            _shouldFilter = true;
            _shouldHideAdvanced = false;

            if (_shouldFilter | _shouldHideAdvanced) {
                _filteredCompletions = new FilteredObservableCollection<Completion>(_completions);

                foreach (var c in _completions.Cast<DynamicallyVisibleCompletion>()) {
                    c.Visible = !_shouldHideAdvanced || !IsAdvanced(c);
                }
                _filteredCompletions.Filter(IsVisible);
            }
        }
 /// <summary>
 /// Default ctor
 /// </summary>
 public XmlResourceCompletionSet(string moniker, string displayName, ITrackingSpan applicableTo, IEnumerable<Completion> completions, IEnumerable<Completion> completionBuilders)
     : base(moniker, displayName, applicableTo, completions, completionBuilders)
 {
     filteredCompletions = new FilteredObservableCollection<Completion>(WritableCompletions);
     filteredCompletionBuilders = new FilteredObservableCollection<Completion>(WritableCompletionBuilders);
 }
 internal PowerShellCompletionSet(string moniker, string displayName, ITrackingSpan applicableTo, IEnumerable<Completion> completions, IEnumerable<Completion> completionBuilders, ITrackingSpan filterSpan, ITrackingSpan lineStartToApplicableTo)
     : base(moniker, displayName, applicableTo, completions, completionBuilders)
 {
     if (filterSpan == null)
     {
         throw new ArgumentNullException("filterSpan");
     }
     this.completions = new FilteredObservableCollection<Completion>(new ObservableCollection<Completion>(completions));
     FilterSpan = filterSpan;
     LineStartToApplicableTo = lineStartToApplicableTo;
     InitialApplicableTo = applicableTo.GetText(applicableTo.TextBuffer.CurrentSnapshot);
 }
Beispiel #6
0
        private Workspace()
        {
            Plugins = new ObservableCollection<Plugin>();

            Services = new FilteredObservableCollection<Plugin>(Plugins, p => p.Type == PluginType.Service);
            Managers = new FilteredObservableCollection<Plugin>(Plugins, p => p.Type == PluginType.Manager);
            Components = new FilteredObservableCollection<Plugin>(Plugins, p => p.Type == PluginType.Component);

            Events = new ObservableCollection<StatementFactory>();
            Actions = new ObservableCollection<StatementFactory>();
            Statements = new ObservableCollection<StatementFactory>();

            NewProjectCommand = new DelegateCommand(null, p =>
            {
                var create = true;

                if (null != Project && CommandHistory.HasUnsavedChanges)
                {
                    DialogService.Warn(Messages.NewProject, Messages.UnsavedMessage, MessageBoxButton.YesNoCancel, r =>
                    {
                        if (r == MessageBoxResult.Yes)
                        {
                            SaveProject();
                        }
                        else if (r == MessageBoxResult.Cancel)
                        {
                            create = false;
                        }
                    });
                }

                if (create)
                {
                    Game game = new Game("Untitled Game");
                    KglGameStorage.AddDefaultUsings(game);

                    var service = new Service(GetPlugin(typeof(RenderService)));
                    service.SetProperty("Width", new Value(800, true));
                    service.SetProperty("Height", new Value(600, true));
                    game.AddService(service);

                    var scene = new Scene("Scene1");

                    var manager = new Manager(GetPlugin(typeof(RenderManager)));
                    scene.AddManager(manager);

                    game.AddScene(scene);
                    game.FirstScene = scene;

                    Project project = new Project();
                    project.Game = game;

                    DialogService.ShowDialog<ProjectDialog>(project, (result) =>
                    {
                        if (result == true)
                        {
                            ProjectStorage.CreateProject(project);
                            Project = project;
                        }
                    });
                }
            });

            LoadProjectCommand = new DelegateCommand(null, p =>
            {
                var load = true;

                if (null != Project && CommandHistory.HasUnsavedChanges)
                {
                    DialogService.Warn(Messages.LoadProject, Messages.UnsavedMessage, MessageBoxButton.YesNoCancel, r =>
                    {
                        if (r == MessageBoxResult.Yes)
                        {
                            SaveProject();
                        }
                        else if (r == MessageBoxResult.Cancel)
                        {
                            load = false;
                        }
                    });
                }

                if (load)
                {
                    DialogService.ShowLoadDialog((result, fileName) =>
                    {
                        if (result == true)
                        {
                            try
                            {
                                LoadProject(fileName);
                            }
                            catch (EditorException e)
                            {
                                DialogService.Warn(Messages.FailedToLoad, e.Message, MessageBoxButton.OK);
                            }
                        }
                    });
                }
            });

            SaveProjectCommand = new DelegateCommand(p => null != project, p =>
            {
                if (null == Project.Title)
                {
                    DialogService.ShowSaveDialog(
                        (result, fileName) =>
                        {
                            if (result == true)
                            {
                                Project.Title = fileName;
                            }
                        }
                    );
                }

                if (null != Project.Title)
                {
                    SaveProject();
                }
            });

            RevertProjectCommand = new DelegateCommand(p => null != Project, p => RevertProject());

            Assembly core = typeof(Kinectitude.Core.Base.Component).Assembly;
            RegisterPlugins(core);

            DirectoryInfo path = new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, PluginDirectory));
            if (path.Exists)
            {
                FileInfo[] files = path.GetFiles("*.dll");
                foreach (FileInfo file in files)
                {
                    Assembly asm = Assembly.LoadFrom(file.FullName);
                    RegisterPlugins(asm);
                }
            }

            CommandHistory = new CommandHistory();
            DialogService = new DialogService();
        }
Beispiel #7
0
 public TestsViewModel()
 {
     AllTests = new ObservableCollection<TestViewModel>();
     FailingTests = new FilteredObservableCollection<TestViewModel>(AllTests, IsFailingTest);
     PassingTests = new FilteredObservableCollection<TestViewModel>(AllTests, IsPassingTest);
 }
        public override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            Disposables.Add(addJobsSubscrition = new SerialDisposable());

            AddJobsCommand = CreateCommand(new ObservableCommand(CanAddJobs()), OnAddJobs);
            SelectAllJobsCommand = CreateCommand(new ObservableCommand(), OnSelectAllJobs);
            FilterJobsCommand = CreateCommand(new ObservableCommand(), OnFilterJobs);

            Disposables.Add(this.GetPropertyValues(x => x.FilterText)
                .Where(f => f != null && Jobs.Filter != f)
                .Sample(TimeSpan.FromMilliseconds(200), schedulerAccessor.UserInterface)
                .Select(filter => Observable.ToAsync(() => Jobs.Filter = filter, schedulerAccessor.Background)())
                .Switch()
                .ObserveOn(schedulerAccessor.UserInterface)
                .Subscribe(_ => State = (Jobs.Count == 0)
                    ? AddJobsViewState.NoResults
                    : AddJobsViewState.Results));

            SelectedJobs = new ObservableCollection<Job>();

            var query = e.Uri.GetQueryValues();

            if (!query.ContainsKey(BuildServerIdKey))
            {
                navigationService.GoBack();
                return;
            }

            IsSelectionEnabled = true;

            int buildServerId = Int32.Parse(query[BuildServerIdKey]);

            StartLoading(Strings.FindingJobsStatusMessage);

            BuildServer = jobRepository.GetBuildServer(buildServerId);

            this.State = AddJobsViewState.Loading;

            jobProviderFactory
                .Get(BuildServer.Provider)
                .GetJobsObservableAsync(BuildServer)
                .Select(jobs => RemoveExistingJobs(BuildServer, jobs))
                .Select(jobs => jobs.Select(CreateAvailableJob)
                    .OrderBy(j => j.Job.Name)
                    .ToList()
                )
                .ObserveOn(schedulerAccessor.UserInterface)
                .Finally(StopLoading)
                .Subscribe(loadedJobs =>
                {
                    existingJobCount = jobController.GetJobs().Count;

                    allJobs = loadedJobs;
                    Jobs = new FilteredObservableCollection<AvailableJob>(loadedJobs, FilterJob, schedulerAccessor.UserInterface);

                    State = (Jobs.Count > 0)
                        ? AddJobsViewState.Results
                        : AddJobsViewState.NoResults;
                }, ex =>
                {
                    ErrorDescription = WebExceptionService.GetDisplayMessage(ex);
                    State = AddJobsViewState.Error;
                });
        }
Beispiel #9
0
        /// <summary>
        /// Initializes a new instance with the specified properties.
        /// </summary>
        /// <param name="moniker">The unique, non-localized identifier for the
        /// completion set.</param>
        /// <param name="displayName">The localized name of the completion set.
        /// </param>
        /// <param name="applicableTo">The tracking span to which the
        /// completions apply.</param>
        /// <param name="completions">The list of completions.</param>
        /// <param name="options">The options to use for filtering and
        /// selecting items.</param>
        /// <param name="comparer">The comparer to use to order the provided
        /// completions.</param>
        public FuzzyCompletionSet(string moniker, string displayName, ITrackingSpan applicableTo, IEnumerable<DynamicallyVisibleCompletion> completions, CompletionOptions options, IComparer<Completion> comparer)
            : base(moniker, displayName, applicableTo, null, null)
        {
            _completions = new BulkObservableCollection<Completion>();
            _completions.AddRange(completions.OrderBy(c => c, comparer));
            _comparer = new FuzzyStringMatcher(options.SearchMode);

            _shouldFilter = options.FilterCompletions;
            _shouldHideAdvanced = options.HideAdvancedMembers;

            if (_shouldFilter | _shouldHideAdvanced) {
                _filteredCompletions = new FilteredObservableCollection<Completion>(_completions);

                foreach (var c in _completions.Cast<DynamicallyVisibleCompletion>()) {
                    c.Visible = !_shouldHideAdvanced || !IsAdvanced(c);
                }
                _filteredCompletions.Filter(IsVisible);
            }
        }
Beispiel #10
0
 public RCompletionSet(ITextBuffer textBuffer, ITrackingSpan trackingSpan, List<RCompletion> completions) :
     base("R Completion", "R Completion", trackingSpan, Enumerable.Empty<RCompletion>(), Enumerable.Empty<RCompletion>()) {
     _textBuffer = textBuffer;
     _completions = OrderList(completions);
     _filteredCompletions = new FilteredObservableCollection<Completion>(_completions);
 }