//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- public LecturesDataTemplate(List <Lecture> lecturesList) { // There always has to be one grade: HEADER = lecturesList[0].SemesterId; LECTURES_GROUP = new CustomObservableCollection <Lecture>(true); LECTURES_GROUP.AddRange(lecturesList); }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 13/06/2018 Created [Fabian Sauter] /// </history> public ManageBookmarksPage() { SystemNavigationManager.GetForCurrentView().BackRequested += BrowseMUCRoomsPage_BackRequested; this.messageResponseHelper = null; this.bookmarks = new CustomObservableCollection <ConferenceItem>(); this.InitializeComponent(); }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 07/02/2018 Created [Fabian Sauter] /// </history> public MucManageControl() { this.fields = new CustomObservableCollection <MUCInfoFieldTemplate>(); this.messageResponseHelper = null; this.saveMessageResponseHelper = null; this.InitializeComponent(); }
// BOOKSHELF/FAVORITE - GET public async Task <CustomObservableCollection <Favorite> > GetUserFavorites(int id, bool refresh = false) { var retList = new CustomObservableCollection <Favorite>(); //Check to see if this is persisted(save trips back to Azure) if (AppSettings.Contains(Constants.FaveKey) && LocalFavorites.Length > 2 && refresh == false) { string json = LocalFavorites; var obj = await Task.Run(() => JsonConvert.DeserializeObject <IEnumerable <Favorite> >(json)); return((CustomObservableCollection <Favorite>)obj); } else { ResetFaveCache(); if (CrossConnectivity.Current.IsConnected) { db = new AzureDB($"Favorite/{id}"); retList = (CustomObservableCollection <Favorite>) await db.GetAllItems <Favorite>(false); } return(retList); } }
/*All Visual elements are bound/scaled to the size of a button, which in turn is one third the width of the screen * by default. This lends itself to pinch to zoom in the future, as binding this change to the button size will * (Hopefully) scale the rest of the UI accordingly.*/ public async void ScreenSetup() { //Sets initial values for Profile and Contacts list. FilteredContacts is designed for extensibility, //and is not used in this MVP. UserProfile = await App.Database.GetProfileAsync(0); Contacts = new CustomObservableCollection <Contact>(await App.Database.GetContactsAsync()); //FilteredContacts = Contacts; await _pageService.DisplayAlert("Developers Note", "Please scroll down and right - couldnt find an" + " elegant way to center this programatically for MVP", "OK"); /*Uncomment to add dummy contact buttons to see how the grid scales. Note the buttons are not * clickable by design as they only exist locally on this page and do not persist (and thus dont * play nicely with the ContactSelected function) Will also dissapear if you go into an info page and * back out. Cannot stress enough that this is essentially a demonstration thing*/ //AddDummyContacts(20); //Sets up the display using predefined settings. SetScaling(); CreateAndShowGrid(); }
public void Should_raise_changed_event_when_adding_deleting_and_manual() { var changedEvents = new List <NotifyCollectionChangedEventArgs>(); var collection = new CustomObservableCollection <string>(); collection.CollectionChanged += (s, e) => changedEvents.Add(e); collection.Add("one"); collection.Add("two"); collection.Remove("one"); collection.RaiseCollectionChanged(); Assert.AreEqual(4, changedEvents.Count); Assert.AreEqual(NotifyCollectionChangedAction.Add, changedEvents[0].Action); Assert.AreEqual("one", changedEvents[0].NewItems.OfType <string>().FirstOrDefault()); Assert.AreEqual(NotifyCollectionChangedAction.Add, changedEvents[1].Action); Assert.AreEqual("two", changedEvents[1].NewItems.OfType <string>().FirstOrDefault()); Assert.AreEqual(NotifyCollectionChangedAction.Remove, changedEvents[2].Action); Assert.AreEqual("one", changedEvents[2].OldItems.OfType <string>().FirstOrDefault()); Assert.AreEqual(NotifyCollectionChangedAction.Reset, changedEvents[3].Action); }
//ALL BOOKS BY ALL USERS public async Task <CustomObservableCollection <Activity> > GetActiveBooksByAllUsers(int uid) { var retList = new CustomObservableCollection <Activity>(); if (CrossConnectivity.Current.IsConnected) { db = new AzureDB($"Activity/{0}/all"); var books = await db.GetAllItems <Activity>(true); //Order by User on top var soList = books.OrderBy(e => e.FullName).Where(e => e.IsReading == true); foreach (var item in soList) { if (item.UserId != uid) { var n = item.FullName.ToFriendlyName(); item.B1Text = $"{n} Books"; item.B2Text = $"Read {item.Book.Title}"; item.LineItem = $"{item.FullName.ToLineItemName()} is reading {item.Book.Title}"; retList.Add(item); } } } return(retList); }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 04/01/2018 Created [Fabian Sauter] /// </history> public BrowseMUCRoomsPage() { SystemNavigationManager.GetForCurrentView().BackRequested += BrowseMUCRoomsPage_BackRequested; this.messageResponseHelper = null; this.rooms = new CustomObservableCollection <MUCRoomTemplate>(); this.InitializeComponent(); }
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\ #region --Set-, Get- Methods-- #endregion //--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\ #region --Misc Methods (Public)-- public void LoadAccounts() { Task.Run(async() => { if (!(loadingAccountsTask is null)) { await loadingAccountsTask; } loadingAccountsTask = Task.Run(() => { IsLoading = true; ConnectionHandler.INSTANCE.ClientsCollectionChanged -= INSTANCE_ClientsCollectionChanged; ConnectionHandler.INSTANCE.ClientsCollectionChanged += INSTANCE_ClientsCollectionChanged; ACCOUNTS.Clear(); CustomObservableCollection <XMPPClient> clients = ConnectionHandler.INSTANCE.getClients(); IEnumerable <AccountDataTemplate> accounts = clients.Select((client) => { return(new AccountDataTemplate { Client = client }); }); ACCOUNTS.AddRange(accounts); }); await loadingAccountsTask; IsLoading = false; }); }
public CollectionResetTestWindow() { InitializeComponent(); DataContext = this; Anchorables = new CustomObservableCollection <object>(); Documents = new CustomObservableCollection <object>(); }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 04/09/2017 Created [Fabian Sauter] /// </history> public PersonalizeSettingsPage() { this.InitializeComponent(); Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += AbstractBackRequestPage_BackRequested; this.BACKGROUND_IMAGES = BackgroundImageCache.backgroundImages; this.CustomBackgroundImage = BackgroundImageCache.customBackgroundImage; }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- public GradesDataTemplate(List <Grade> gradesList) { // There always has to be one grade: HEADER = gradesList[0].LectureSemester; GRADES_GROUP = new CustomObservableCollection <Grade>(true); GRADES_GROUP.AddRange(gradesList); AVERAGE_GRADE = CalcAvgGrade(gradesList); }
public AddBookViewModel(Page page) { Title = "Add Book To Library"; DoSearchCommand = new Command(async() => await DoBookSearch()); SearchResults = new CustomObservableCollection <Book>(); AddToLibraryCommand = new Command(async(obj) => await AddBook(obj)); _page = page; }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- public ConnectionHandler() { IMAGE_DOWNLOAD_HANDLER = new ImageDownloadHandler(DOWNLOAD_HANDLER); Task.Run(async() => await IMAGE_DOWNLOAD_HANDLER.ContinueDownloadsAsync()); CLIENTS = new CustomObservableCollection <ClientConnectionHandler>(false); CLIENTS.CollectionChanged += CLIENTS_CollectionChanged; LoadClients(); }
public Library(IMediaItemPersister mediaItemPersister) { this.mediaItemPersister = mediaItemPersister; log.Info("Creating library..."); mediaItems = new CustomObservableCollection<MediaItem>(this.mediaItemPersister.LoadAll()); log.Info("Library populated successfully"); }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 18/11/2017 Created [Fabian Sauter] /// </history> public ConnectionHandler() { this.IMAGE_DOWNLOAD_HANDLER = new ImageDownloadHandler(DOWNLOAD_HANDLER); Task.Run(async() => await this.IMAGE_DOWNLOAD_HANDLER.ContinueDownloadsAsync()); this.CLIENTS = new CustomObservableCollection <XMPPClient>(false); this.CLIENTS.CollectionChanged += CLIENTS_CollectionChanged; loadClients(); AccountDBManager.INSTANCE.AccountChanged += INSTANCE_AccountChanged; }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 13/04/2018 Created [Fabian Sauter] /// </history> public ConnectionConfiguration() { this.invokeInUiThread = false; this.tlsMode = TLSConnectionMode.FORCE; this.IGNORED_CERTIFICATE_ERRORS = new CustomObservableCollection <ChainValidationResult>(false); this.IGNORED_CERTIFICATE_ERRORS.CollectionChanged += IGNORED_CERTIFICATE_ERRORS_CollectionChanged; this.disableStreamManagement = false; this.disableMessageCarbons = false; }
public Library(IMediaItemPersister mediaItemPersister) { this.mediaItemPersister = mediaItemPersister; log.Info("Creating library..."); mediaItems = new CustomObservableCollection<MediaItem>(this.mediaItemPersister.LoadAll()); log.Info("Library populated successfully"); }
public UsersVM() { _users = Serializer.Deserialize <List <User> >(FileName) ?? new List <User> { new User("Krzys", @"C:\Users\filip\Pictures\John-Prideaux-headshot_picmonkeyed.jpg"), new User("SuperKrzys", null) }; _observableUsers = new CustomObservableCollection <ObservableUser, User>(_users, u => new ObservableUser(u)); Application.Current.Exit += CurrentOnExit; }
private void InitializeObservableCollections() { Lines = new CustomObservableCollection <LineModel>(); DestinationNumbers = new CustomObservableCollection <LineModel>(); var clientsTask = Task.Factory.StartNew(() => _lineService.GetClients()); Clients = new ObservableCollection <ClientModel>(clientsTask.Result.Result); RaisePropertyChanged(nameof(Clients)); }
//ctor public PaymentCalculationViewModel(INavigationService navigationService, ILineService lineService) { _navigationService = navigationService; _lineService = lineService; Invoice = new InvoiceModel(); Client = new ClientModel(); Lines = new CustomObservableCollection <LineModel>(); InitializeObservableCollections(); InitializeMethods(); }
public BookListViewModel() { Library = new CustomObservableCollection <Book>(); Title = "Book List"; LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); // NOT USING THIS FOR RIGHT NOW 1/22/2019 // SelectedBookCommand = new Command<Book>(ShowMenu); StartReadingCommand = new Command(async(obj) => await StartReading(obj)); AddBookCommand = new Command(async() => await Application.Current.MainPage.Navigation.PushAsync(new AddBookPage())); BookDetailsCommand = new Command(async(obj) => await ShowDetails(obj)); }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 29/08/2017 Created [Fabian Sauter] /// </history> public ChatDetailsControl() { this.sendDummyMessages = 0; this.chatMessages = new CustomObservableCollection <ChatMessageDataTemplate>(); this.InitializeComponent(); // Disable the test button on release builds: #if !DEBUG test_bnt.Visibility = Visibility.Collapsed; #endif }
/* * Constructor used to create a new medication */ public SingleMedicationPage(MedicationsPage medicationsPage, int selectedList) { InitializeComponent(); AddMedicationLayout.IsVisible = true; UserViewLayout.IsVisible = false; this.Title = "Add New Medication"; drugAutoFillActiveIngredientsAPI = new DrugAutoFillActiveIngredientsAPI(); observableMedicationList = new CustomObservableCollection <string>(); MedicationsList.ItemsSource = observableMedicationList; parentmedicationsPage = medicationsPage; this.selectedList = selectedList; }
/// <summary> /// Constructor for when a user opens their messages /// </summary> public MessageThreadsListPage() { InitializeComponent(); Title = "Messages"; CheckIfClinicianAccessing(); conversationList = new CustomObservableCollection <Conversation>(); activeConversations = new List <int>(); ConversationsListView.ItemsSource = conversationList; VSAppCenter.setConversationListController(this); }
public UserSearchPage() { InitializeComponent(); IsLoading = false; endOfUsers = false; currentIndex = 0; UserList = new CustomObservableCollection <User>(); UserListView.ItemsSource = UserList; UserListView.RefreshCommand = RefreshCommand; UserSearchBar.SearchCommand = SearchCommand; UserSearchBar.TextChanged += UserSearchBar_TextChanged; UserListView.ItemAppearing += HitBottomOfList; }
public ActivityListViewModel(Page page) { Title = $"{DispName} Bookshelf"; Activities = new CustomObservableCollection <Activity>(); LoadItemsCommand = new Command(async() => await LoadCollectionForUser()); SelectedActivityCommand = new Command <Activity>(ShowMenu); MarkAsReadCommand = new Command <Activity>(async(Activity obj) => await SetBookAsRead(obj)); SortCommand = new Command((obj) => DoSort(obj)); FavoriteCommand = new Command <Activity>(async(Activity obj) => await SetAsFavorite(obj)); FilterCommand = new Command(async() => await FilterFavorites()); ViewBookInfoCommand = new Command <Activity>((Activity obj) => GoToBookDetails(obj)); OtheReadersCommand = new Command <Activity>(async(Activity obj) => await ShowWhoIsReading(obj)); _page = page; }
public OptimalPackageViewModel(ILineService lineService, INavigationService navigationService) { _lineService = lineService; _navigationService = navigationService; Customer = new CustomerDto(); Line = new LineDto(); Customer = new ObservableCollection <CustomerDto>(); Lines = new CustomObservableCollection <LineDto>(); var customerTask = Task.Factory.StartNew(() => _lineService.GetClients()); Customer = new ObservableCollection <CustomerDto>(customerTask.Result.Result); RaisePropertyChanged(nameof(Customer)); }
public CreateConversationPage(List <int> activeConversations) { InitializeComponent(); IsLoading = false; endOfUsers = false; currentIndex = 0; UserList = new CustomObservableCollection <User>(); UserListView.ItemsSource = UserList; UserListView.RefreshCommand = RefreshCommand; UserSearchBar.SearchCommand = SearchCommand; UserSearchBar.TextChanged += UserSearchBar_TextChanged; Title = "New Conversation"; UserListView.ItemAppearing += HitBottomOfList; this.activeConversations = activeConversations; }
//ALL READ BOOKS BY USER(either current user or another app user) public async Task <CustomObservableCollection <Activity> > GetAllBooksByUser(int id, bool refresh = false) { var retList = new CustomObservableCollection <Activity>(); var act = await GetBooksByUser(id, refresh, !refresh); //Sort active on top var soList = act.OrderBy(e => e.IsReading ? 0 : 1).ThenBy(e => e.Book.Title); foreach (var item in soList) { item.LineItem = $"{item.Book.Title} - {item.Book.Author}"; retList.Add(item); } return(retList); }
public PointsPage() { InitializeComponent(); recommendationsList = new CustomObservableCollection <string>(); RecommendationsList.ItemsSource = recommendationsList; people = new List <Image>(); // for (int i = 1; i < 36; i++) // { // // // people.Add(image); // } savedLivesText.Text = String.Format("You could save {0} lives", calculateSavedLives()); helpedLivesText.Text = String.Format("and you could also help {0} lives", calculateHelpedLives()); }
public void Should_raise_changed_event_when_adding_deleting_and_manual() { var changedEvents = new List<NotifyCollectionChangedEventArgs>(); var collection = new CustomObservableCollection<string>(); collection.CollectionChanged += (s, e) => changedEvents.Add(e); collection.Add("one"); collection.Add("two"); collection.Remove("one"); collection.RaiseCollectionChanged(); Assert.AreEqual(4, changedEvents.Count); Assert.AreEqual(NotifyCollectionChangedAction.Add, changedEvents[0].Action); Assert.AreEqual("one", changedEvents[0].NewItems.OfType<string>().FirstOrDefault()); Assert.AreEqual(NotifyCollectionChangedAction.Add, changedEvents[1].Action); Assert.AreEqual("two", changedEvents[1].NewItems.OfType<string>().FirstOrDefault()); Assert.AreEqual(NotifyCollectionChangedAction.Remove, changedEvents[2].Action); Assert.AreEqual("one", changedEvents[2].OldItems.OfType<string>().FirstOrDefault()); Assert.AreEqual(NotifyCollectionChangedAction.Reset, changedEvents[3].Action); }
public FeedRepository(IPersistence persistence) { this.persistence = persistence; feeds = new CustomObservableCollection<Feed>(Load()); }