private async Task PopulateMapAsync()
        {
            var idsAsString = NavigationNearbyStationIdList.Split(new char[] { ',' });
            var ids = idsAsString.Select(Int32.Parse).ToList();

            var hst = await _dataService.GetHaltestellenAsync(ids);
            var mapPins = new List<MapHaltestelleModel>();

            foreach (var h in hst)
            {
                try
                {
                    var mapHst = new MapHaltestelleModel()
                                {
                                    Id = h.Id,
                                    Bezeichnung = h.Bezeichnung,
                                    GeoCoordinate = new GeoCoordinate(h.Latitude, h.Longitude)
                                };

                    mapPins.Add(mapHst);
                }
                catch (Exception)
                {
                    // ArgumentOutOfRangeException from new GeoCoordinate(..., ...): we then do not show this station
                }
            }

            NearbyStations = new BindableCollection<MapHaltestelleModel>(mapPins);
            NotifyOfPropertyChange(() => NearbyStations);

            _eventAggregator.Publish(new ZoomMapToPinsMessage(), _eventAggregator.PublishOnUIThread);
        }
 public FileSwitchDialogViewModel(LayoutElementViewModel layoutElement)
 {
     m_layoutElement = layoutElement;
       m_files = m_layoutElement.FileUseOrder;
       m_switchFileCommand = new GenericManualCommand<int>(SwitchFile, null, Converter);
       m_showCloseButton = false;
 }
 public MonstersViewModel(ILibrary library, IEventAggregator eventAggregator)
 {
     this.DisplayName = "monsters";
     this.eventAggregator = eventAggregator;
     this.library = library;
     this.items = this.library.Monsters;
 }
        public EmailListViewModel()
        {
            var now = DateTimeOffset.Now;
            this.emails = new BindableCollection<EmailViewModel>
                              {
                                  new EmailViewModel
                                      {
                                          Sender = "Margaret G. Melton",
                                          Subject = "Sanitary Checks Tomorrow",
                                          Received = now.Subtract(TimeSpan.FromMinutes(2))
                                      },
                                  new EmailViewModel
                                      {
                                          Sender = "Samuel B. Sanchez",
                                          Subject = "More Rats in the Study",
                                          Received = now.Subtract(TimeSpan.FromDays(1))
                                      },
                                    new EmailViewModel
                                      {
                                          Sender = "Samuel B. Sanchez",
                                          Subject = "Rats in the Basement",
                                          Received = now.Subtract(TimeSpan.FromHours(25))
                                      },
                                    new EmailViewModel
                                      {
                                          Sender = "Janice K. Burson",
                                          Subject = "Dirty Chicken Sink",
                                          Received = now.Subtract(TimeSpan.FromDays(2))
                                      }
                              };

            this.selectedEmails = new BindableCollection<EmailViewModel>();
        }
Beispiel #5
0
 public RoomViewModel(Room room)
 {
     this.room = room;
       this.dispatcher = Dispatcher.CurrentDispatcher;
       this.messages = new BindableCollection<IMessageViewModel>();
       this.users = new BindableCollection<User>();
 }
Beispiel #6
0
        protected override void OnInitialize()
        {
            base.OnInitialize();
            _bugRepository.BugSaved += (s, e) => { if (!Bugs.Contains(e.Bug)) Bugs.Add(e.Bug); };
            _bugRepository.BugDeleted += (s, e) => Bugs.Remove(e.Bug);

            Bugs = new BindableCollection<Bug>(_bugRepository);
        }
        public ChangeCardLabelsViewModel(object root) : base(root)
        {
            _eventAggregator = IoC.Get<IEventAggregator>();
            _api = IoC.Get<ITrello>();
            _progress = IoC.Get<IProgressService>();

            Labels = new BindableCollection<Label>();
        }
        public void CreateContextMenu(FrameworkElement view, IObservableCollection<ContextMenuModel> contextMenuItems)
        {
            var contextMenu = new PopupMenu { Manager = _shell.GetMenuManager() };
            BarManager.SetDXContextMenu(view, contextMenu);

            foreach (var item in contextMenuItems)
            {
                AddContextMenuItem(contextMenu, item);
            }
        }
        protected override void OnInitialize()
        {
            base.OnInitialize();

            this.RecentProjects=new BindableCollection<Project>();
            for (int i = 0; i < 5; i++)
                this.RecentProjects.Add(new Project() { Name = "Test" + i });

            NotifyOfPropertyChange(()=> this.NoRecentProjects);
        }
			public PreAssignedCollectionViewModel(
				IObservableCollection<CustomerViewModel> collection,
				ServiceFactory<ICustomerService> customerServiceFactory)
			{
				CustomerCollection = collection;

				customerServiceFactory
					.Collection(this, x => x.CustomerCollection)
					.Fill(x => x.GetCustomersWithTurnoverGreatherThan(0));
			}
        public MoveCardToBoardViewModel(object root) : base(root)
        {
            _eventAggregator = IoC.Get<IEventAggregator>();
            _api = IoC.Get<ITrello>();
            _progress = IoC.Get<IProgressService>();

            Boards = new BindableCollection<Board>();
            Lists = new BindableCollection<List>();

            PropertyChanged += OnPropertyChanged;
        }
Beispiel #12
0
 public RoomViewModel(
     MessageService messageService,
     RoomService roomService,
     UserService userService)
 {
     _messageService = messageService;
     _roomService = roomService;
     _userService = userService;
     _messages = new BindableCollection<MessageViewModel>();
     _users = new BindableCollection<RoomUserViewModel>();
 }
Beispiel #13
0
        private IUndoableAction Pop(IObservableCollection <IUndoableAction> stack)
        {
            if (stack.Count == 0)
            {
                return(null);
            }

            var r = stack[stack.Count - 1];

            stack.RemoveAt(stack.Count - 1);
            return(r);
        }
Beispiel #14
0
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="source">Coleção de origem com todos os dados da lista.</param>
 /// <param name="selectedItems">Relação dos itens selecionados.</param>
 /// <param name="selectionComparer">Comparador que será utilizado na solução.</param>
 /// <param name="selectedItemCreator">Delegate usado para cria o item selecionado.</param>
 public SelectionCollection(IObservableCollection <T> source, IObservableCollection <TProxy> selectedItems, SelectionEntryEqualityComparer <T, TProxy> selectionComparer, Func <T, TProxy> selectedItemCreator)
 {
     source.Require("source").NotNull();
     selectedItems.Require("selectedItems").NotNull();
     selectionComparer.Require("selectionComparer").NotNull();
     selectedItemCreator.Require("selectedItemCreator").NotNull();
     _selectionComparer   = selectionComparer;
     _selectedItemCreator = selectedItemCreator;
     _selectedItems       = selectedItems;
     Initialize(source, CreateEntryProxy, null);
     _selectedItems.CollectionChanged += SelectedItemsCollectionChanged;
 }
Beispiel #15
0
        public static FilteredView <T> AsFilteredView <T>(
            this IObservableCollection <T> collection,
            Func <T, bool> filter,
            params IObservable <object?>[] triggers)
        {
            if (collection is null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            return(new FilteredView <T>(collection, filter, TimeSpan.Zero, false, triggers));
        }
Beispiel #16
0
            public CommandsListMonitor(CommandBar bar,
                IObservableCollection<AppBarCommandViewModel> source)
            {
                if (bar == null) throw new ArgumentNullException("bar");
                if (source == null) throw new ArgumentNullException("source");

                _bar = bar;
                _source = source;

                _bar.Unloaded += OnUnloaded;
                _source.CollectionChanged += OnCollectionChanged;
            }
Beispiel #17
0
 public CategoryDesign()
 {
     Category = SampleCategory.Dialogs;
     Items    = new BindableCollection <ISample> {
         new GenericSampleDesign(), new GenericSampleDesign()
     };
     NextSamples = new BindableCollection <string>()
     {
         "Foo", "Bar"
     };
     ActiveItem = Items[0];
 }
Beispiel #18
0
 private void ResetListBinder()
 {
     if (this.dataList != null)
     {
         this.dataList.OnObjectAdd    -= new Action <object>(this.OnAdd);
         this.dataList.OnObjectRemove -= new Action <object>(this.OnRemove);
         this.dataList.OnClear        -= new Action(this.OnClear);
     }
     this.dataList = null;
     this.alldataList.Clear();
     this.OnClear();
 }
Beispiel #19
0
 public static FilteredView <T> AsFilteredView <T>(
     this IObservableCollection <T> collection,
     Func <T, bool> filter,
     TimeSpan bufferTime,
     IScheduler scheduler,
     params IObservable <object>[] triggers)
 {
     Ensure.NotNull(collection, nameof(collection));
     Ensure.NotNull(filter, nameof(filter));
     Ensure.NotNull(scheduler, nameof(scheduler));
     return(new FilteredView <T>(collection, filter, bufferTime, scheduler, triggers));
 }
        public TodoItemViewModel(TodoItem item)
        {
            this.item = item;

            this.tags = new BindableCollection <TagViewModel>();
            foreach (var tag in item.Tags)
            {
                var model = new TagViewModel(tag);
                this.tags.Add(model);
                model.OnRemove += this.OnRemoveTag;
            }
        }
        public CardDetailChecklistViewModel(IEventAggregator eventAggregator,
                                            IWindowManager window,
                                            Func <ChecklistViewModel> checklistFactory)
        {
            DisplayName = "checklists";

            _eventAggregator  = eventAggregator;
            _window           = window;
            _checklistFactory = checklistFactory;

            Checklists = new BindableCollection <ChecklistViewModel>();
        }
        private void Properties_Changed(IList <object> propertyGroups)
        {
            if (propertyGroups == null)
            {
                return;
            }

            _projectPropertyNames = propertyGroups.ObservableSelectMany(group => ((CollectionViewGroup)group).Items);
            _projectPropertyNames.CollectionChanged += (sender, e) => ProjectProperties_CollectionChanged(e);

            Initialize();
        }
        public ProcessListViewModel(IRemoteProcessService processService, IBus bus)
            : base(bus)
        {
            this.processService = processService;
            Contract.Requires <ArgumentNullException>(processService != null);
            Contract.Requires <ArgumentNullException>(bus != null);

            this.processModulesCollection = new BindableCollection <IProcessModules>();
            this.processService.GetAll().Where(p => p.IsAttached).Apply(this.AddProcessModules);
            this.Title = "Processes";
            this.Bus.Subscribe(this);
        }
        public AttachToProcessViewModel(
            IRemoteProcessService remoteProcessService, IRemoteProcessCommandService remoteProcessCommandService)
        {
            Contract.Requires<ArgumentNullException>(remoteProcessService != null);
            Contract.Requires<ArgumentNullException>(remoteProcessCommandService != null);

            this.remoteProcessService = remoteProcessService;
            this.remoteProcessCommandService = remoteProcessCommandService;
            this.remoteProcesses = this.remoteProcessService.GetAll();
            this.selectedItems = new BindableCollection<IRemoteProcess>();
            this.selectedItems.CollectionChanged += (sender, args) => this.NotifyOfPropertyChange(() => this.CanAttach);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EditableListView{T}"/> class.
 /// </summary>
 /// <param name="list">The collection to decorate.</param>
 /// <param name="leaveOpen">True means that <paramref name="list"/> is not disposed when this instance is diposed.</param>
 public EditableListView(IObservableCollection <T> list, bool leaveOpen)
     : base(list)
 {
     this.leaveOpen     = leaveOpen;
     this.subscriptions = new CompositeDisposable(2)
     {
         list.ObservePropertyChangedSlim()
         .Subscribe(this.OnPropertyChanged),
         list.ObserveCollectionChangedSlim(signalInitial: false)
         .Subscribe(this.OnCollectionChanged),
     };
 }
Beispiel #26
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         if (boundCollection != null)
         {
             boundCollection.CollectionChanged -= itemsChangedHandler;
         }
         boundCollection = null;
     }
 }
Beispiel #27
0
        public TodoItemViewModel(TodoItem item)
        {
            this.item = item;

            this.tags = new BindableCollection<TagViewModel>();
            foreach (var tag in item.Tags)
            {
                var model = new TagViewModel(tag);
                this.tags.Add(model);
                model.OnRemove += this.OnRemoveTag;
            }
        }
        public AttachToProcessViewModel(
            IRemoteProcessService remoteProcessService, IRemoteProcessCommandService remoteProcessCommandService)
        {
            Contract.Requires <ArgumentNullException>(remoteProcessService != null);
            Contract.Requires <ArgumentNullException>(remoteProcessCommandService != null);

            this.remoteProcessService        = remoteProcessService;
            this.remoteProcessCommandService = remoteProcessCommandService;
            this.remoteProcesses             = this.remoteProcessService.GetAll();
            this.selectedItems = new BindableCollection <IRemoteProcess>();
            this.selectedItems.CollectionChanged += (sender, args) => this.NotifyOfPropertyChange(() => this.CanAttach);
        }
Beispiel #29
0
        void BindingAdd(IObservableCollection col, object item)
        {
            Game.RunAfterTick(() =>
            {
                if (collection != col)
                {
                    return;
                }

                BindingAddImpl(item);
            });
        }
        public CollectionSyncer(ICollection <T> t, Func <T, U> create)
        {
            _create = create;
            INotifyCollectionChanged collection = t as INotifyCollectionChanged;

            if (collection == null)
            {
                throw new ArgumentException("The ICollection<T> must be INotifyCollectionChanged");
            }
            CollectionChangedEventManager.AddListener(collection, this);
            _syncCollection = new BindableCollection <U>();
            t.Apply(item => _syncCollection.Add(_create(item)));
        }
Beispiel #31
0
 public View(IObservableCollection <T> source, Func <T, TView> selector, bool reverse)
 {
     this.source   = source;
     this.selector = selector;
     this.reverse  = reverse;
     this.filter   = SynchronizedViewFilter <T, TView> .Null;
     this.SyncRoot = new object();
     lock (source.SyncRoot)
     {
         this.ringBuffer = new RingBuffer <(T, TView)>(source.Select(x => (x, selector(x))));
         this.source.CollectionChanged += SourceCollectionChanged;
     }
 }
Beispiel #32
0
        public ProjectDependenciesViewModel([NotNull] Solution solution)
        {
            Contract.Requires(solution != null);

            _references   = solution.Projects.ObservableSelect(project => new ProjectDependency(this, null, project, proj => proj.References));
            _referencedBy = solution.Projects.ObservableSelect(project => new ProjectDependency(this, null, project, proj => proj.ReferencedBy));

            Groups = new[]
            {
                new ProjectDependencyGroup("References", _references),
                new ProjectDependencyGroup("Referenced By", _referencedBy),
            };
        }
Beispiel #33
0
        public ChecklistViewModel(ITrelloApiSettings settings,
                                  INavigationService navigation,
                                  IEventAggregator eventAggregator,
                                  IWindowManager windows,
                                  Func <ChecklistItemViewModel> itemFactory) : base(settings, navigation)
        {
            _itemFactory     = itemFactory;
            _eventAggregator = eventAggregator;
            _windows         = windows;
            _eventAggregator.Subscribe(this);

            Items = new BindableCollection <ChecklistItemViewModel>();
        }
        public async void SearchForMatchesAsync(string searchString)
        {
            if (!CanStartSearch(searchString))
                return;

            Haltestellen = null;
            NotifyOfPropertyChange(() => Haltestellen);

            var result = await _dataService.GetHaltestellenContainingAsync(searchString);

            Haltestellen = new BindableCollection<Haltestelle>(result);
            NotifyOfPropertyChange(() => Haltestellen);
        }
 /// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="name">Nome do indice.</param>
 /// <param name="collection">Coleção que será observada.</param>
 /// <param name="watchProperties">Relação das propriedades assistidas.</param>
 /// <param name="keyGetter">Ponteiro do método usado para recupera o valor da chave do item.</param>
 /// <param name="comparer">Comparador que será utilizado.</param>
 public ObservableCollectionIndex(string name, IObservableCollection <T> collection, string[] watchProperties, Func <T, object> keyGetter, System.Collections.IComparer comparer)
 {
     name.Require("name").NotNull().NotEmpty();
     collection.Require("collection").NotNull();
     keyGetter.Require("keyGetter").NotNull();
     comparer.Require("comparer").NotNull();
     _name            = name;
     _collection      = collection;
     _watchProperties = watchProperties ?? new string[0];
     _keyGetter       = keyGetter;
     _comparer        = comparer;
     _collection.CollectionChanged += CollectionCollectionChanged;
 }
 /// <summary>
 /// Libera a instancia.
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (_source != null)
     {
         _source.CollectionChanged -= SourceCollectionChanged;
         foreach (var item in _source)
         {
             UnregisterItem(item);
         }
     }
     _source = null;
     _indexes.Dispose();
 }
 public CollectionTreeViewModel(IObservableCollection<string> paths = null)
 {
     m_paths = paths;
       if (paths != null)
       {
     foreach (string path in paths)
     {
       if (Directory.Exists(path))
     m_children.Add(new DirectoryViewModel(path));
     }
     paths.CollectionChanged += PathsOnCollectionChanged;
       }
 }
Beispiel #38
0
 public ShellViewModel([ImportMany] IEnumerable <ISample> samples)
 {
     DisplayName       = "CMContrib WPF Demo";
     LogItems          = new BindableCollection <string>();
     SamplesByCategory = new BindableCollection <CategorySamples>();
     foreach (var samplesByCategory in samples
              .GroupBy(x => x.Category)
              .OrderBy(x => x.Key.ToString()))
     {
         SamplesByCategory.Add(new CategorySamples(samplesByCategory.Key,
                                                   new BindableCollection <ISample>(samplesByCategory)));
     }
 }
Beispiel #39
0
        public EditorManager(IFileViewModel setting, MainViewModel mainViewModel)
        {
            m_editorsWithSettings = new FilteredObservableCollection<IEditor>(m_baseEditors, editor => editor.Settings != null);
              m_setting = setting;
              m_mainViewModel = mainViewModel;
              m_imageViewerViewModel = new ImageViewerViewModel();
              m_jsonEditorViewModel = new JsonEditorViewModel(mainViewModel);
              m_simpleEditor = new BaseTextEditorViewModel(mainViewModel);
              m_findInFilesViewModel = new FindInFilesViewModel(mainViewModel);

              UpdateSettings();
              m_setting.ContentChanged += SettingOnContentChanged;
        }
Beispiel #40
0
        // Initializations

        #region Initializations

        public ShellViewModel(IThemeManager themeManager, IMenu mainMenu, IToolBarTray toolBarTray, IStatusBar statusBar)
        {
            _themeManager = themeManager;

            MainMenu = mainMenu;

            StatusBar = statusBar;

            ToolBarTray = toolBarTray;

            Tools = new BindableCollection <ITool>();

            _closing = false;
        }
        public TestSocketVM()
        {
            _localSettings = ApplicationData.Current.LocalSettings;
            _inComes       = new ObservableCollectionExtended <ClientInComeMessage>();
            var canConnect = this.WhenAnyValue(vm => vm.HostName, vm => vm.Port, vm => vm.IsConnect,
                                               (hostname, port, isconnect) => !string.IsNullOrWhiteSpace(hostname) && port > 1000 && !isconnect);
            var canSendMessage = this.WhenAnyValue(vm => vm.TextMessage, vm => vm.IsConnect, (t, isconnect) => !string.IsNullOrWhiteSpace(t) && isconnect);

            Connect2Server    = ReactiveCommand.CreateFromTask(_connect2Server, canConnect);
            Disconnect4Server = ReactiveCommand.Create(_disconnect4Server);
            SendMessage       = ReactiveCommand.CreateFromTask(_sendMessage, canSendMessage);
            HostName          = (string)_localSettings.Values["HostName"] ?? "";
            Port = uint.Parse(_localSettings.Values["Client.Port"]?.ToString() ?? "1000");
        }
        /// <summary>
        /// Constructor with collection and reference creator function</summary>
        /// <param name="collection">Collection</param>
        /// <param name="createReference">Reference creator function</param>
        public ReferenceCollectionAdapter(IObservableCollection <IReference <TRefTarget> > collection, Func <U, IReference <TRefTarget> > createReference)
            : base(collection)
        {
            m_collection      = collection;
            m_createReference = createReference;

            m_targetToRefMap = new Dictionary <U, IReference <TRefTarget> >();
            foreach (var item in m_collection)
            {
                m_targetToRefMap.Add(item.Target.As <U>(), item);
            }

            m_collection.CollectionChanged += CollectionCollectionChanged;
        }
Beispiel #43
0
        public Node(string name, bool isExpanded, BitmapImage icon, IObservableCollection <ResourceViewModel> resources = null, IObservableCollection <Node> children = null)
        {
            _name       = name;
            _isExpanded = isExpanded;
            _icon       = icon;
            Nodes       = children ?? new ObservableCollection <Node>();

            if (resources != null)
            {
                Resources = resources;
                Resources.PropertyChanged += ResourcesOnPropertyChanged;
                _propChangedName           = new ActionDeferrer(() => Notify("Name"), TimeSpan.FromSeconds(0.5), Dispatcher.CurrentDispatcher);
            }
        }
        public PacketListViewModel(
            Guid processId, PacketFactory packetFactory, IOpenPacketDetails openPacketDetails, IDataSource dataSource)
        {
            Contract.Requires <ArgumentNullException>(packetFactory != null);
            Contract.Requires <ArgumentNullException>(openPacketDetails != null);
            Contract.Requires <ArgumentNullException>(dataSource != null);

            this.processId         = processId;
            this.packetFactory     = packetFactory;
            this.openPacketDetails = openPacketDetails;
            this.dataSource        = dataSource;

            this.packets = new BindableCollection <PacketViewModel>();
        }
        /// <summary>
        /// Filters the sequence using the specified <paramref name="wherePredicate"/>.
        /// </summary>
        /// <typeparam name="TElement">Type of elements in the collection</typeparam>
        /// <param name="collection">Collection to filter</param>
        /// <param name="wherePredicate">Predicate used for filtering</param>
        /// <returns>Observable enumerable with filtered elements</returns>
        public static IObservableCollectionSubset <TElement> Where <TElement>(this IObservableCollection <TElement> collection,
                                                                              Predicate <TElement> wherePredicate)
        {
            if (collection == null)
            {
                throw new NullReferenceException();
            }
            if (wherePredicate == null)
            {
                throw new ArgumentNullException(nameof(wherePredicate));
            }

            return(new ObervableCollectionSubset <TElement>(collection, wherePredicate));
        }
Beispiel #46
0
        private TextBand NewTitle(IObservableCollection collection, string text)
        {
            TextBand result = new TextBand(collection);

            result.Text = text;

            result.Format.Font.Size      = 12;
            result.Format.Font.Style     = Steema.TeeGrid.Format.FontStyle.Bold;
            result.Format.Font.Color     = ColorTranslator.FromHtml("#034684");
            result.Format.Stroke.Visible = true;
            result.Format.Stroke.Size    = 3;
            result.Format.Stroke.Color   = ColorTranslator.FromHtml("#6BABD0");
            return(result);
        }
Beispiel #47
0
        public DirectoryViewModel(string path, ITreeNode parrent = null, IObservableCollection<FileViewModel> allFiles = null, SynchronizationContext synchronizationContext = null)
        {
            if (synchronizationContext == null)
              {
            if (parrent is DirectoryViewModel)
              synchronizationContext = ((DirectoryViewModel)parrent).m_synchronizationContext;
            if (synchronizationContext == null)
              synchronizationContext = SynchronizationContext.Current;
              }
              Debug.Assert(synchronizationContext != null, "SynchronizationContext should not be null");
              m_synchronizationContext = synchronizationContext;

              m_children = new SortedObservableCollection<ITreeNode>(new AsyncObservableCollection<ITreeNode>(synchronizationContext),
                          (node, treeNode) => (String.Compare(node.Name, treeNode.Name, StringComparison.Ordinal) + (node is DirectoryViewModel ? -1000 : 0) + (treeNode is DirectoryViewModel ? 1000 : 0)), m_synchronizationContext);
              m_path = path;
              m_parrent = parrent;
              m_name = System.IO.Path.GetFileName(path);
              if (!Directory.Exists(path))
            return;
              if (allFiles == null)
              {
            m_allFiles = new SortedObservableCollection<FileViewModel>(new AsyncObservableCollection<FileViewModel>(), (model, viewModel) => String.Compare(model.Name, viewModel.Name, StringComparison.Ordinal));
            allFiles = AllFiles;
              }
              foreach (string directory in Directory.GetDirectories(path))
            Children.Add(new DirectoryViewModel(directory, this, allFiles, m_synchronizationContext));
              foreach (string file in Directory.GetFiles(path))
              {
            FileViewModel fileViewModel = new FileViewModel(file, this);
            Children.Add(fileViewModel);
            allFiles.Add(fileViewModel);
              }
              if (parrent == null)
              {
            m_externalChanges = new Dictionary<string, DateTime>();
            m_fileSystemWatcher = new FileSystemWatcher(path)
            {
              NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite,
              IncludeSubdirectories = true
            };

            m_fileSystemWatcher.Created += FileSystemWatcherOnCreated;
            m_fileSystemWatcher.Deleted += FileSystemWatcherOnDeleted;
            m_fileSystemWatcher.Changed += FileSystemWatcherOnChanged;
            m_fileSystemWatcher.Renamed += FileSystemWatcherOnRenamed;

            m_fileSystemWatcher.EnableRaisingEvents = true;
            m_cleanUpTimer = new Timer(ClanUp, null, 5000, Timeout.Infinite);
              }
        }
 public UnionCollection(IObservableCollection <TFirst> first, IObservableCollection <TSecond> second)
 {
     if (first != null)
     {
         _first = first;
         first.CollectionChanged += First_CollectionChanged;
     }
     if (second != null)
     {
         second.CollectionChanged += SecondOnCollectionChanged;
         _second = second;
     }
     _enumerator = new UnionEnumerator <TFirst, TSecond, TCommon>(first, second);
 }
        public ChatMessageGroupViewModel(ChatMessageViewModel message)
            : base(false)
        {
            IsNotifying = false;

            _messages = new BindableCollection<ChatMessageViewModel> {message};
            _messages.CollectionChanged += MessagesOnCollectionChanged;
            _user = message.User;
            MessageDateTime = message.MessageDateTime;
            MessageId = message.MessageId;
            LastMessageDateTime = message.MessageDateTime;

            IsNotifying = true;
        }
Beispiel #50
0
        public PositionsViewModel(IClient client)
        {
            this.DisplayName = "Positions";
            this.positions = new BindableCollection<Position>();

            foreach (var position in client.Accounts.SelectMany(accounts => accounts.PositionsStorage.Positions))
            {
                this.positions.Add(new Position(position));
            }

            foreach (var account in client.Accounts)
            {
                account.PositionsStorage.PositionAdded += (sender, eventArgs) => this.positions.Add(new Position(eventArgs.Position));
            }
        }
Beispiel #51
0
 public GraphicsCompositorGraph([NotNull] IObservableCollection <IGraphicsCompositorBlockViewModel> blocks, IObservableCollection <IGraphicsCompositorBlockViewModel> selectedBlocks, IObservableCollection <IGraphicsCompositorLinkViewModel> selectedLinks)
 {
     if (blocks == null)
     {
         throw new ArgumentNullException(nameof(blocks));
     }
     this.blocks                         = blocks;
     this.selectedBlocks                 = selectedBlocks;
     this.selectedLinks                  = selectedLinks;
     blocks.CollectionChanged           += BlocksCollectionChanged;
     selectedBlocks.CollectionChanged   += SelectedBlocksCollectionChanged;
     selectedLinks.CollectionChanged    += SelectedLinksCollectionChanged;
     selectedVertices.CollectionChanged += SelectedVerticesCollectionChanged;
     selectedEdges.CollectionChanged    += SelectedEdgesCollectionChanged;
 }
        protected override void OnActivate()
        {
            base.OnActivate();

            this.host.GetGenres(genres =>
                {
                    if (genres == null)
                    {
                        this.navigationService.GoBack();
                        return;
                    }

                    this.Genres = new BindableCollection<GenreViewModel>(genres);
                    NotifyOfPropertyChange(() => this.Genres);
                });
        }
Beispiel #53
0
        public OrdersViewModel(IClient client)
        {
            this.DisplayName = "Orders";

            this.orders = new BindableCollection<OrderView>();

            foreach (var order in client.Accounts.SelectMany(account => account.OrdersStorage.Orders))
            {
                this.Orders.Add(new OrderView(order));
            }

            foreach (var account in client.Accounts)
            {
                account.OrdersStorage.OrderAdded += this.OnOrderAdded;
            }
        }
Beispiel #54
0
        public ExecutionsViewModel(IClient client)
        {
            this.DisplayName = "Executions";

            this.executions = new BindableCollection<ExecutionView>();

            foreach (var execution in client.Accounts.SelectMany(account => account.ExecutionsStorage.Executions))
            {
                this.executions.Add(new ExecutionView(execution));
            }

            foreach (var account in client.Accounts)
            {
                account.ExecutionsStorage.ExecutionAdded += this.OnExecutionAdded;
            }
        }
        protected override void OnActivate()
        {
            base.OnActivate();

            this.host.ListMovies(movies =>
                {
                    if (movies == null)
                    {
                        this.navigationService.GoBack();
                        return;
                    }

                    this.Movies = new BindableCollection<MovieViewModel>(movies.Select(m => new MovieViewModel(host, navigationService, m)));
                    NotifyOfPropertyChange(() => Movies);
                });
        }
        private void ItemsLoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            if (e.Cancelled)
            {

            }
            else if (e.Error != null)
            {

            }
            else
            {
                AllProjects = new BindableCollection<Project>(_collection);
                this.NotifyOfPropertyChange(()=> this.AllProjects);
            }
        }
        public ProcessModulesViewModel(IRemoteProcess remoteProcess, IItem processDetails, IEnumerable<IModule> modules)
        {
            Contract.Requires<ArgumentNullException>(remoteProcess != null);
            Contract.Requires<ArgumentNullException>(processDetails != null);
            Contract.Requires<ArgumentNullException>(modules != null);

            this.remoteProcess = remoteProcess;
            this.processDetails = processDetails;
            this.iconSource = null;
            this.modules = new BindableCollection<IModule>(modules);

            var inpc = remoteProcess as INotifyPropertyChanged;
            if (inpc == null)
            {
                return;
            }

            PropertyChangedEventManager.AddHandler(
                inpc, (sender, args) => this.NotifyOfPropertyChange(() => this.Name), string.Empty);
        }
 public MainMenuViewModel(IShortcut[] menuItems)
 {
     this.menuItems = new BindableCollection<IShortcut>(menuItems);
 }
Beispiel #59
0
        public void Bind(IObservableCollection c, Func<object, Widget> makeWidget, Func<Widget, object, bool> widgetItemEquals, bool autoScroll)
        {
            this.autoScroll = autoScroll;

            Game.RunAfterTick(() =>
            {
                if (collection != null)
                {
                    collection.OnAdd -= BindingAdd;
                    collection.OnRemove -= BindingRemove;
                    collection.OnRemoveAt -= BindingRemoveAt;
                    collection.OnSet -= BindingSet;
                    collection.OnRefresh -= BindingRefresh;
                }

                this.makeWidget = makeWidget;
                this.widgetItemEquals = widgetItemEquals;

                RemoveChildren();
                collection = c;

                if (c != null)
                {
                    foreach (var item in c.ObservedItems)
                        BindingAddImpl(item);

                    c.OnAdd += BindingAdd;
                    c.OnRemove += BindingRemove;
                    c.OnRemoveAt += BindingRemoveAt;
                    c.OnSet += BindingSet;
                    c.OnRefresh += BindingRefresh;
                }
            });
        }
        public Solution(ITracer tracer, IVsServiceProvider serviceProvider)
        {
            Contract.Requires(tracer != null);
            Contract.Requires(serviceProvider != null);

            _deferredUpdateThrottle = new DispatcherThrottle(DispatcherPriority.ContextIdle, Update);

            _tracer = tracer;
            _serviceProvider = serviceProvider;

            _specificProjectConfigurations = Projects.ObservableSelectMany(prj => prj.SpecificProjectConfigurations);
            _solutionContexts = SolutionConfigurations.ObservableSelectMany(cfg => cfg.Contexts);
            _defaultProjectConfigurations = Projects.ObservableSelect(prj => prj.DefaultProjectConfiguration);
            _projectConfigurations = new ObservableCompositeCollection<ProjectConfiguration>(_defaultProjectConfigurations, _specificProjectConfigurations);

            _solutionEvents = Dte?.Events?.SolutionEvents;
            if (_solutionEvents != null)
            {
                _solutionEvents.Opened += Solution_Changed;
                _solutionEvents.AfterClosing += Solution_Changed;
                _solutionEvents.ProjectAdded += _ => Solution_Changed();
                _solutionEvents.ProjectRemoved += _ => Solution_Changed();
                _solutionEvents.ProjectRenamed += (_, __) => Solution_Changed();
            }

            Update();
        }