public void RemoveEventRaised() { BindableCollection<SimpleBusinessObject> lBindableCollection = new BindableCollection<SimpleBusinessObject>(); bool removingRaised = false; lBindableCollection.ItemRemovedEvent += delegate(object sender, ItemRemovedEventArgs ea) { removingRaised = true; }; Assert.IsFalse(removingRaised); lBindableCollection.Add(new SimpleBusinessObject()); Assert.IsFalse(removingRaised); lBindableCollection.RemoveAt(0); Assert.IsTrue(removingRaised); SimpleBusinessObject sbo = new SimpleBusinessObject(); lBindableCollection.Add(sbo); removingRaised = false; lBindableCollection.Remove(sbo); Assert.IsTrue(removingRaised); }
public void BindableCollectionEnumeratorFrozen() { // Initialize the test data BindableCollection<Contact> customers = new BindableCollection<Contact>(); customers.Add(new Contact() { Name = "Paul" }); customers.Add(new Contact() { Name = "Greg" }); customers.Add(new Contact() { Name = "Sam" }); // Enumerate over the items, and whilst enumerating, add some new items. The new items // should be added and should not effect the items being enumerated. int enumerated = 0; foreach (Contact customer in customers) { enumerated++; // This would normally raise an InvalidOperationException customers.Add(new Contact() { Name = "Jack " + enumerated }); } // Check that the items were actually added and enumerated correctly Assert.AreEqual(3, enumerated); Assert.AreEqual("Paul", customers[0].Name); Assert.AreEqual("Greg", customers[1].Name); Assert.AreEqual("Sam", customers[2].Name); Assert.AreEqual("Jack 1", customers[3].Name); Assert.AreEqual("Jack 2", customers[4].Name); Assert.AreEqual("Jack 3", customers[5].Name); }
public DynamicColumnManagementViewModel(ILog log, IDispatcherSchedulerProvider scheduler, IStandardDialog standardDialog, IDynamicColumnManagementService service, BindableCollection<DynamicColumn> columnsCollection, BindableCollection<IToolBarItem> toolBarItemsCollection, Func<DynamicColumnEditViewModel> editViewModelFactory, IToolBarService toolBarService) : base(log, scheduler, standardDialog) { _service = service; _editViewModelFactory = editViewModelFactory; Disposables.Add(service); Columns = columnsCollection; ToolBarItems = toolBarItemsCollection; var saveToolBarItem = toolBarService.CreateToolBarButtonItem(); saveToolBarItem.DisplayName = "Save"; _saveCommand = new DelegateCommand(() => { ClosingStrategy.Close(); }); saveToolBarItem.Command = _saveCommand; ToolBarItems.Add(saveToolBarItem); var cancelToolBarItem = toolBarService.CreateToolBarButtonItem(); cancelToolBarItem.DisplayName = "Cancel"; cancelToolBarItem.Command = ClosingStrategy.CloseCommand; ToolBarItems.Add(cancelToolBarItem); }
public void raises_a_collectionchanged_event_for_each_item_added() { var collection = new BindableCollection<string>(); var eventsFired = 0; collection.CollectionChanged += (source, args) => { eventsFired++; }; collection.Add("abc"); collection.Add("def"); Assert.That(eventsFired, Is.EqualTo(2), "The collection should have raised a CollectionChanged event twice."); }
public BindableCollection<ModoPago> BuscarModosPago() { BindableCollection<ModoPago> listaModoPagos = new BindableCollection<ModoPago>(); ; SqlConnection conn = new SqlConnection(Properties.Settings.Default.inf245g4ConnectionString); SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandText = "SELECT * FROM ModoPago"; cmd.CommandType = CommandType.Text; cmd.Connection = conn; try { conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { ModoPago mp = new ModoPago(); mp.IdModoPago = reader.IsDBNull(reader.GetOrdinal("idModoPago")) ? -1 : (int)reader["idModoPago"]; mp.Nombre = reader.IsDBNull(reader.GetOrdinal("nombre")) ? null : reader["nombre"].ToString(); listaModoPagos.Add(mp); } conn.Close(); } catch (Exception e) { MessageBox.Show(e.StackTrace.ToString()); } return listaModoPagos; }
public DataPresentationViewModel() { DisplayName = "Presentation"; RefreshBtnContent = "Refresh"; Diagrams = new BindableCollection<DiagramViewModel>(); LocationsLbl = "Locations:"; Locations = new BindableCollection<LocationViewModel>(); GetLocations(); TimeSpanLbl = "Timespan:"; TimeSpans = new BindableCollection<string>(); TimeSpans.Add("Year"); TimeSpans.Add("Month"); TimeSpans.Add("Week"); TimeSpans.Add("Day"); TimeSpans.Add("Hour"); }
public FingerTrackingOptionsViewModel() { Colors = new BindableCollection<Color>(); foreach (var property in typeof(Color).GetProperties().Where(p => p.PropertyType == typeof(Color))) { Colors.Add((Color)property.GetValue(new Color())); } MinContourArea = 100; ConvexHullCW = false; ConvexHullColor = Color.Green; ContourHighlightColor = Color.Blue; DefectStartPointHighlightColor = Color.Violet; DefectDepthPointHighlightColor = Color.Black; DefectEndPointHighlightColor = Color.Yellow; DefectLinesColor = Color.Red; SelectedMethod = 2; TrackOnlyControlPoint = false; if (Execute.InDesignMode) LoadDesignTimeData(); }
public BindableCollection<SubLineaProducto> ObtenerSubLineas(int id) { db.cmd.CommandText = "SELECT * FROM SubLineaProducto WHERE idLinea=@idLinea"; db.cmd.Parameters.AddWithValue("idLinea", id); SqlDataReader reader; BindableCollection<SubLineaProducto> lstSubLinea = new BindableCollection<SubLineaProducto>(); try { db.conn.Open(); reader=db.cmd.ExecuteReader(); while (reader.Read()) { SubLineaProducto slp = new SubLineaProducto(); slp.IdLinea = id; slp.Nombre=reader["Nombre"].ToString(); slp.IdSubLinea = Int32.Parse(reader["IdSubLinea"].ToString()); slp.Abreviatura = reader["Abreviatura"].ToString(); lstSubLinea.Add(slp); } db.cmd.Parameters.Clear(); reader.Close(); db.conn.Close(); } catch (SqlException e) { Console.WriteLine(e); } catch (Exception e) { Console.WriteLine(e.StackTrace.ToString()); } return lstSubLinea; }
IObservableCollection<DirectoryUser> _getUsers(string filter) { var entry = new DirectoryEntry("LDAP://" + _settings.LdapPath); var ds = new DirectorySearcher(entry) { Filter = filter, SearchScope = SearchScope.OneLevel }; var results = new BindableCollection<DirectoryUser>(); using (entry) using (ds) { var searchResults = ds.FindAll(); foreach (SearchResult searchResult in searchResults) { var userPrincipalName = searchResult.Properties["userPrincipalName"]; var fullname = searchResult.Properties["cn"]; results.Add(new DirectoryUser(userPrincipalName.Count > 0 ? (string)userPrincipalName[0] : "", fullname.Count > 0 ? (string)fullname[0] : "")); } } return results; }
public DateTimeViewModel() { Days = new BindableCollection<int>(); Months = new Dictionary<int, string>(); Years = new BindableCollection<int>(); Hours = new BindableCollection<int>(); Minutes = new BindableCollection<int>(); for (var i = 0; i < 24; i++) Hours.Add(i + 1); for (var i = 0; i < 60; i++) Minutes.Add(i); for (var i = DateTime.Now.Year - 20; i < DateTime.Now.Year + 20; i++) Years.Add(i); SelectedYear = DateTime.Now.Year; OnMonthsChanged(); SelectedDay = DateTime.Now.Day; SelectedMonth = Months.Single(c => c.Key == DateTime.Now.Month); SelectedHour = DateTime.Now.Hour; SelectedMinute = DateTime.Now.Minute; }
public EndoscopyViewModel(IEventAggregator events, int sessionId) { DisplayName = "Ná»™i soi"; if (App.Current != null) { _esClinicContext = App.Current.EsClinicContext; } _events = events; _sessionId = sessionId; Photos = new BindableCollection<TmpPhoto>(); IsEnabledScopy = true; NotifyOfPropertyChange(() => IsEnabledScopy); EsTypes = new BindableCollection<EndoscopyType>(); var esTypes = _esClinicContext.EndoscopyTypes.ToList(); foreach (var esType in esTypes) { EsTypes.Add(esType); } Cameras = new BindableCollection<Camera>(); foreach (var camera in CameraService.AvailableCameras) { Cameras.Add(camera); } _selectedCamera = Cameras.FirstOrDefault(); }
public static BindableCollection<string> ToBindableCollection(this ADOTabular.ADOTabularDatabaseCollection databases) { var ss = new BindableCollection<string>(); foreach (var dbname in databases) { ss.Add(dbname); } return ss; }
private static IObservableCollection<DistanceViewModel> createPoints(int begin, int end, int step) { if (end <= 0) return null; var collection = new BindableCollection<DistanceViewModel>(); for (var i = begin; i < end; i = i + step) collection.Add(new DistanceViewModel(i)); return collection.Count > 0 ? collection : null; }
private static IObservableCollection<TimeViewModel> createTicks(int count) { if (count <= 0) return null; var collection = new BindableCollection<TimeViewModel>(); for (var i = 0; i < count; i++) collection.Add(new TimeViewModel(i)); return collection.Count > 0 ? collection : null; }
public AllPlayerViewModel(List<Player> playerList) { Players = new BindableCollection<PlayerViewModel>(); foreach (Player item in playerList) { Players.Add(new PlayerViewModel(item)); } }
public BowlingPlayer() { Frames = new BindableCollection<BowlingFrame>(); for (var i = 0; i < Constants.Frames; i++) { var frame = new BowlingFrame() { Index = i }; Frames.Add(frame); } }
public MainMenuViewModel() { Groups = new BindableCollection<MenuGroup>(); if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled) { _running = IoC.Get<RunExperimentViewModel>(); _runThresholdTest = IoC.Get<RunThresholdTestViewModel>(); _permutations = IoC.Get<PermutationViewModel>(); _nbsmConfig = IoC.Get<NBSmConfigViewModel>(); _eventAggregator = IoC.Get<IEventAggregator>(); _navService = IoC.Get<INavigationService>(); _regionService = IoC.Get<IRegionService>(); _subjectService = IoC.Get<ISubjectDataService>(); _subjectFilterService = IoC.Get<ISubjectFilterService>(); _computeService = IoC.Get<IComputeService>(); var regionsVM = IoC.Get<RegionsViewModel>(); Groups.Add(new MenuGroup { Title = "Source", Items = { regionsVM, IoC.Get<SubjectsViewModel>(), IoC.Get<GroupsViewModel>() } }); Groups.Add(new MenuGroup { Title = "Config", Items = { _permutations, _nbsmConfig } }); Groups.Add(new MenuGroup { Title = "Compute", Items = { _runThresholdTest, _running } }); Groups.Add(new MenuGroup { Title = "Global", Items = { IoC.Get<GlobalStrengthViewModel>() } }); Groups.Add(new MenuGroup { Title = "Component", Items = { IoC.Get<IntermodalViewModel>(), IoC.Get<IntraSummaryViewModel>()/*, new MenuItem { Title = "Associations" },*/ } }); Groups.Add(new MenuGroup { Title = "Nodal", Items = { IoC.Get<NodalStrengthDataTypeViewModel>() } }); Groups.Add(new MenuGroup { Title = "Edge", Items = { IoC.Get<EdgeSignificanceViewModel>() } }); } }
private void LoadFillLevelReadings() { foreach (var reading in m_Repository.FillLevelReadings.OfType <FillLevelReading>()) { m_FillLevelReadings.Add(m_ReadingViewModelFactory.CreateFromExisting(reading)); } NotifyOfPropertyChange(() => EvaluationYears); NotifyOfPropertyChange(() => FilteredItems); }
public void UpdateClients() { var r = new BindableCollection<IScreen>(); foreach (var c in AppState.Imb.Groups) r.Add(new GroupViewModel { Group = c, Plugin = plugin }); foreach (var c in AppState.Imb.AllClients) r.Add(new ContactViewModel { Client = c, Plugin = plugin}); cv.Clients.ItemsSource = Clients = r; }
private void LoadFillLevelReadings() { foreach (var reading in m_Repository.FillLevelReadings.OfType <FillLevelReading>()) { m_FillLevelReadings.Add(CreateReadingVM(reading)); } NotifyOfPropertyChange(() => FilteredReadings); NotifyOfPropertyChange(() => CalendarEntries); }
private void FillSeasons() { SeasonModel season = new SeasonModel(); BindableCollection <SeasonModel> ss = season.GiveCollection(season.All()); Seasons = new BindableCollection <SeasonModel>(); season.Year = "All"; Seasons.Add(season); season = new SeasonModel { Year = "None" }; Seasons.Add(season); foreach (SeasonModel s in ss) { Seasons.Add(s); } }
public PinPickerViewModel() { Pins = new BindableCollection<int>(); if (Execute.InDesignMode) { for (var i = 0; i <= 10; i++) Pins.Add(i); } }
//Seat map operations public async void UpdateSeatMap() { if (SeatsByAreaId == null) { windowManager.ShowDialog(new ErrorViewModel(MyResources.SelectAreaMsg)); } else { var seats = SeatsByAreaId; int coordX = selectedArea.CoordX; int row = 1; int number = 1; int step = 0; var finalList = new BindableCollection <SeatModel>(); foreach (var item in seats) { if (step == coordX) { row++; number = 1; step = 0; } if (item.Number != -1) { item.Row = row; item.Number = number; number++; finalList.Add(item); } else { item.Row = row; finalList.Add(item); } step++; } await managerService.UpdateSeatMap(finalList); } }
/// <summary> /// Initializes a new instance of the <see cref="TransactionDetailsViewModel"/> class. /// </summary> /// <param name="validator">Validator for view model data.</param> /// <param name="accountsVM">Accounts view model.</param> /// <param name="categoriesVM">Categories view model.</param> public TransactionDetailsViewModel(IValidator validator, IAccountsViewModel accountsVM, ICategoriesViewModel categoriesVM) : base(validator) { this.accountsVM = accountsVM; this.categoriesVM = categoriesVM; var accounts = new BindableCollection <AccountDTO>(); accountsCollectionViewSource.Source = accounts; this.accountsVM.Reloaded += (sender, args) => { accounts.Clear(); foreach (var account in this.accountsVM.Accounts) { accounts.Add(account as AccountDTO); } if (!accountsCollectionViewSource.View.IsEmpty) { accountsCollectionViewSource.View.MoveCurrentToFirst(); } }; var categories = new BindableCollection <CategoryDTO>(); categoriesCollectionViewSource.Source = categories; this.categoriesVM.Reloaded += (sender, args) => { categories.Clear(); categories.AddRange(this.categoriesVM.Categories); if (!categoriesCollectionViewSource.View.IsEmpty) { categoriesCollectionViewSource.View.MoveCurrentToFirst(); } }; categoryFilter = (search, item) => { if (string.IsNullOrEmpty(search)) { return(true); } if (item is CategoryDTO) { string searchToLower = search.ToLower(CultureInfo.InvariantCulture); return((item as CategoryDTO).Name.ToLower(CultureInfo.InvariantCulture).Contains(searchToLower)); } return(false); }; }
private void PopulateSMSRecipipentsOnSingleGroupListView(int identity) { GroupRecipientsList = new BindableCollection <SMSrecipientDefinition>(); _originalRecipientsOfGroup = GetRecipientsFromOneGroup(GetRecipientsFromProperGroup(identity).RecipientsArray); foreach (var item in _originalRecipientsOfGroup) { GroupRecipientsList.Add(item); } }
private void LoadInspectionViewModels() { if (m_Repository.Inspections != null) { foreach (var inspection in m_Repository.Inspections.OfType <Approval_Inspection>().Where(i => i.Progress == 2)) { m_InspectionViewModels.Add(m_InspectionViewModelFactory.CreateInspectionViewModel(inspection)); } } }
private void UpdateReferences() { var referencesIds = Regex.Matches(jsonData, @"""(\w+/\w+)"""); references.Clear(); foreach (Match match in referencesIds) { references.Add(match.Groups[1].Value); } }
public TweetTrackerViewModel(TwitterFeedViewModel feed) { Tweets = new BindableCollection<string>(); feed.PropertyChanged += (_, args) => { if (args.PropertyName == "SelectedTweet") { Tweets.Add(feed.SelectedTweet.Text); } }; }
private RaceLapsGroup GetOrAddGroup(int index) { while (groups.Count <= index) { var group = new RaceLapsGroup(race, calculator, groups.Count); AttachGroupEvents(@group); groups.Add(group); } return(groups[index]); }
public static void SortDescending <TSource, TKey>(this BindableCollection <TSource> source, Func <TSource, TKey> keySelector) { List <TSource> sorted = source.OrderByDescending(keySelector).ToList(); source.Clear(); foreach (var item in sorted) { source.Add(item); } }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var theString = value.ToString(); var parts = theString.Split(new[] {' ', ','}, StringSplitOptions.RemoveEmptyEntries); var collection = new BindableCollection<ButtonModel>(); parts.Apply(x => collection.Add(new ButtonModel(x))); return collection; }
private void AddNotExistingToChildren(BindableCollection <KeyValueUnitViewModel> viewModels, IReadOnlyCollection <Tag> newTags) { foreach (Tag newTag in newTags) { if (viewModels.All(c => !string.Equals(c.Name, newTag.Name))) { viewModels.Add(new KeyValueUnitViewModel(this, newTag)); } } }
public EditLicenceViewModel() { DriversLicences = new BindableCollection <DriversLicence>(); List <DriversLicence> data = DriversLicenceProcessor.LoadDriversLicences(); foreach (var item in data) { DriversLicences.Add(item); } }
public static BindableCollection <string> ToBindableCollection(this ADOTabular.ADOTabularDatabaseCollection databases) { var ss = new BindableCollection <string>(); foreach (var dbname in databases) { ss.Add(dbname); } return(ss); }
private BindableCollection <TimeZoneInfo> GetTimeZoneInfoList() { BindableCollection <TimeZoneInfo> timeZoneInfos = new BindableCollection <TimeZoneInfo>(); foreach (TimeZoneInfo tzi in TimeZoneInfo.GetSystemTimeZones().ToList()) { timeZoneInfos.Add(tzi); } return(timeZoneInfos); }
private void CreateCatalogViewModel(Catalog catalog) { var cvm = m_MeasureViewModelFactory.CreateFromExisting(catalog); foreach (var measure in catalog.Measures) { CreateMeasureViewModel(measure, cvm); } m_Catalogs.Add(cvm); }
public void AddToSelectedRegions() { if (!string.IsNullOrWhiteSpace(SelectedRegionName)) { BuildExistingRegions(); } SelectedRegions.Add(new RegionModel(SelectedRegionName, true)); ReloadSelectedStore(); NotifyOfPropertyChange(() => CanAddToSelectedRegions); }
private void ReadAndInitializeChildQueues() { Children = new BindableCollection <QueueTreeNodeViewModel>(); var privateQueues = _queueService.GetPrivateQueues(_queueConnectionContext.ComputerName); foreach (var queue in privateQueues) { Children.Add(new QueueTreeNodeViewModel(_eventAggregator, queue, _queueService, _dialogService)); } }
public static BindableCollection <DateTime> FormatChange(this List <string> collection) { BindableCollection <DateTime> newCollection = new BindableCollection <DateTime>(); foreach (var data in collection) { newCollection.Add(Convert.ToDateTime(data)); } return(newCollection); }
public TElement AddElement <TElement>(double x, double y) where TElement : ElementViewModel, new() { var element = new TElement { X = x, Y = y }; _elements.Add(element); return(element); }
public SettingsViewModel(IRgbService rgbService) { DeviceSettingsViewModels = new BindableCollection <RgbDeviceSettingsViewModel>(); foreach (var device in rgbService.LoadedDevices) { DeviceSettingsViewModels.Add(new RgbDeviceSettingsViewModel(device)); } rgbService.DeviceLoaded += UpdateDevices; }
public BindableCollection <ProductsModel> FindAndDisplayProductFindedByType() { BindableCollection <ProductsModel> toReturn = new BindableCollection <ProductsModel>(); foreach (var product in ApiConnectModel.FindByOneType(SelectedType).Result) { toReturn.Add(product); } return(toReturn); }
public void Init() { AlarmEntries = new BindableCollection <AlarmEntryViewModel>(); AlarmEntries.Add(new AlarmEntryViewModel(Machine.Context.Alarms_AirPressureErrorDevice)); AlarmEntries.Add(new AlarmEntryViewModel(Machine.Context.Alarms_BackwardClampingCylinderBackwardErrorDevice)); AlarmEntries.Add(new AlarmEntryViewModel(Machine.Context.Alarms_BackwardClampingCylinderDownErrorDevice)); AlarmEntries.Add(new AlarmEntryViewModel(Machine.Context.Alarms_BackwardClampingCylinderForwardErrorDevice)); AlarmEntries.Add(new AlarmEntryViewModel(Machine.Context.Alarms_BackwardClampingCylinderUpErrorDevice)); AlarmEntries.Add(new AlarmEntryViewModel(Machine.Context.Alarms_ForwardClampingCylinderBackwardErrorDevice)); AlarmEntries.Add(new AlarmEntryViewModel(Machine.Context.Alarms_ForwardClampingCylinderDownErrorDevice)); AlarmEntries.Add(new AlarmEntryViewModel(Machine.Context.Alarms_ForwardClampingCylinderForwardErrorDevice)); AlarmEntries.Add(new AlarmEntryViewModel(Machine.Context.Alarms_ForwardClampingCylinderUpErrorDevice)); ResetAlarmsCommand = new DelegateCommand( () => Machine.Context.Alarms_ResetAlarmsCommandDevice.WriteTrue()); }
public FolderTreeViewModel(string basePath) { if (!Directory.Exists(basePath)) { throw new ArgumentException("Directory " + basePath + " does not exist."); } var basefolder = new FolderViewModel(basePath); Folders = new BindableCollection <FolderViewModel>(); Folders.Add(basefolder); }
public MainViewModel(ITicTacToeService game) { Winner = " "; Play = Visibility.Hidden; _game = game; Cells = new BindableCollection <MainFieldElementViewModel>(); for (var i = 0; i < 9; i++) { Cells.Add(new MainFieldElementViewModel(i / 3, i % 3, Condition.FREE, this, game)); } }
public async Task Add() { var dialogViewModel = new AddTodoViewModel(); var success = await windowManager.ShowDialogAsync(dialogViewModel); if (success == true) { Todos.Add(new TodoViewModel(dialogViewModel.Name)); } }
public static BindableCollection <MaterialViewModel> ConvertToModels(this IEnumerable <MaterialBase> models) { var list = new BindableCollection <MaterialViewModel>(); foreach (var model in models) { list.Add(model.ConvertToModel()); } return(list); }
/// <summary> /// Initializes a new instance of the <see cref="ResourceViewModel" /> class. /// </summary> /// <param name="resource">The resource.</param> public ResourceViewModel(Resource resource) { Resource = resource; Children = new BindableCollection <ResourceViewModel>(); Indicator = new IndicatorViewModel(); if (resource.HasChildren != 0) { Children.Add(Placeholder); } }
private async Task LoadCustomers() { var customersName = await _customerAccess.GetCustomersName(); Customers = new BindableCollection <string>(); foreach (var name in customersName) { Customers.Add(name); } }
private async Task LoadInitialData() { var data = await GlobalData.GetAsync(); heroes.IsNotifying = false; // empty hero for 'all' heroes.Add(new Hero("")); heroes.AddRange(data.Heroes.OrderBy(x => x.Name)); heroes.IsNotifying = true; heroes.Refresh(); }
private async Task LoadProducers() { var producersFromAPI = await _producerAccess.GetProducerNamesAll(); ProducersName = new BindableCollection <string>(); foreach (var producer in producersFromAPI) { ProducersName.Add(producer); } }
public async Task<BindableCollection<ResultViewModel>> Initialize() { _objectStorageHelper = new ObjectStorageHelper<List<ResultViewModel>>(StorageType.Local); var storageList = await _objectStorageHelper.LoadAsync(); var result = new BindableCollection<ResultViewModel>(); foreach (var item in storageList) result.Add(item); return result; }
public void IsSerializable() { BindableCollection<SimpleBusinessObject> lBindableCollection = new BindableCollection<SimpleBusinessObject>(); lBindableCollection.Add(new SimpleBusinessObject()); lBindableCollection[0].Name = "Alice"; lBindableCollection[0].Age = 30; lBindableCollection[0].Description = "wants to get an encrypted message from bob :)"; System.Runtime.Serialization.Formatters.Binary.BinaryFormatter lBinaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); System.IO.MemoryStream lMemoryStream = new System.IO.MemoryStream(); lBinaryFormatter.Serialize(lMemoryStream, lBindableCollection); }
public MyWeekViewModel(INavigationService navigationService, IFreeletics dataservice) : base(navigationService) { this.navigationService = navigationService; this.dataservice = dataservice; AllDone = NoCoach = false; Trainings = new BindableCollection<TrainingViewModel>(); #if DEBUG if (Execute.InDesignMode) { Number = 4; var w = new BindableCollection<WorkoutViewModel>(); w.Add(new WorkoutViewModel() { IdxWeek = 1, Name = "apollon", Title = "APOLLON", WorkoutType = "Standard", Time = "3:04" }); w.Add(new WorkoutViewModel() { IdxWeek = 2, Name = "gaia", Title = "6/10 GAIA", WorkoutType = "Standard", Active = true }); w.Add(new WorkoutViewModel() { IdxWeek = 3, Name = "dione", Title = "DIONE", WorkoutType = "Standard" }); Trainings.Add(new TrainingViewModel() { Workouts = w }); } #endif }
public void ItemAddedEventRaised() { BindableCollection<SimpleBusinessObject> lBindableCollection = new BindableCollection<SimpleBusinessObject>(); bool itemAddedRaised = false; lBindableCollection.ItemAddedEvent += delegate(object sender, AddingNewEventArgs ea) { itemAddedRaised = true; }; Assert.IsFalse(itemAddedRaised); lBindableCollection.Add(new SimpleBusinessObject()); Assert.IsTrue(itemAddedRaised); }
public BindableCollection<IComputer> FindMatchingComputers(string filterName) { if (!filterName.EndsWith("*") && !filterName.EndsWith("$") && !filterName.EndsWith("%")) { filterName = filterName += "$"; } if (filterName.EndsWith("%")) { filterName = filterName.Replace('%', '*'); } string filter = string.Format("(&(objectCategory=Computer)(sAMAccountName={0}))", filterName); BindableCollection<IComputer> Matches = new BindableCollection<IComputer>(); DirectoryEntry de = new DirectoryEntry(string.Format("LDAP://{0}",GetClosestDC())); DirectorySearcher ds = new DirectorySearcher(de); SearchResultCollection results; try { ds.ReferralChasing = ReferralChasingOption.All; ds.SearchScope = SearchScope.Subtree; ds.PropertiesToLoad.Add("sAMAccountName"); ds.Filter = filter; results = ds.FindAll(); if (results.Count > 0) { foreach (SearchResult sr in results) { Computer c = new Computer() { Name = sr.Properties["sAMAccountName"][0].ToString().Replace("$", "") }; Matches.Add(c); } } results.Dispose(); } catch { //ERROR.... } finally { de.Dispose(); ds.Dispose(); } return Matches; }
public EndoscopyManageViewModel() { if (App.Current != null) { _esClinicContext = App.Current.EsClinicContext; } EsTypes = new BindableCollection<EndoscopyType>(); var esTypes = _esClinicContext.EndoscopyTypes.ToList(); foreach (var esType in esTypes) { EsTypes.Add(esType); } }
public UserInfoManageViewModel() { if (App.Current != null) { _esClinicContext = App.Current.EsClinicContext; } Users = new BindableCollection<User>(); var users = _esClinicContext.Users.ToList(); foreach (var user in users) { Users.Add(user); } }
public SurchargeManageViewModel() { if (App.Current != null) { _esClinicContext = App.Current.EsClinicContext; } Surcharges = new BindableCollection<Surcharge>(); var surcharges = _esClinicContext.Surcharges.ToList(); foreach (var surcharge in surcharges) { Surcharges.Add(surcharge); } }
/// <summary> /// Constructor with Properties /// </summary> /// <param name="name">The name of the Classroom.</param> /// <param name="computers">a BindableCollection<ActionsHomeModel> of Computer Objects</param> public ClassroomActions(string name, BindableCollection<IComputer> computers = null) { this.Name = name; if (computers != null) { Computers = new BindableCollection<ActionsHomeModel>(); foreach (IComputer c in computers) { Computers.Add(new ActionsHomeModel(c)); } } else { Computers = new BindableCollection<ActionsHomeModel>(); } }