Esempio n. 1
0
        async Task FetchAcquaintances()
        {
            IsBusy = true;
            var list = new ObservableRangeCollection <Restaurant>();
            var item = new Restaurant {
                Name = "Name", Address = "Address"
            };
            var item1 = new Restaurant {
                Name = "Name1", Address = "Address"
            };
            var item2 = new Restaurant {
                Name = "Name2", Address = "Address"
            };
            var item3 = new Restaurant {
                Name = "Name3", Address = "Address"
            };

            //Retaurants = new ObservableRangeCollection<Retaurant>(await _DataSource.GetItems());
            list.Add(item);
            list.Add(item1);
            list.Add(item2);
            list.Add(item3);
            Retaurants = list;
            IsBusy     = false;
        }
Esempio n. 2
0
        public ChatViewModel()
        {
            goParticipantesCommand = new Command(ExecutegoParticipantesCommand);

            twilio = DependencyService.Get <ITwilio>();

            Mensagens = new ObservableRangeCollection <Mensagem>();

            EnviarMensagemCommand = new Command(() =>
            {
                var mensagem = new Mensagem
                {
                    Texto     = MensagemEnviada,
                    Recebendo = false,
                    HoraEnvio = DateTime.Now
                };


                Mensagens.Add(mensagem);

                twilio?.EnviarMensagem(mensagem.Texto);

                MensagemEnviada = string.Empty;
            });

            if (twilio == null)
            {
                return;
            }

            twilio.MensagemAdicionada = (mensagem) =>
            {
                Mensagens.Add(mensagem);
            };
        }
        public PlantViewModel()
        {
            Title             = "Browse";
            Plants            = new ObservableRangeCollection <Plant>();
            LoadPlantsCommand = new Command(async() => await ExecuteLoadPlantsCommand());

#if __IOS__
            MessagingCenter.Subscribe <iOS.PlantNewViewController, Plant>(this, "AddPlant", async(obj, item) =>
            {
                var _item = item as Plant;
                Plants.Add(_item);
                await DataStore.AddPlantAsync(_item);
            });
#elif __ANDROID__
            MessagingCenter.Subscribe <Android.App.Activity, Plant>(this, "AddPlant", async(obj, item) =>
            {
                var _item = item as Plant;
                Plants.Add(_item);
                await DataStore.AddPlantAsync(_item);
            });
#else
            MessagingCenter.Subscribe <AddPlants, Plant>(this, "AddPlant", async(obj, item) =>
            {
                var _item = item as Plant;
                Plants.Add(_item);
                await DataStore.AddPlantAsync(_item);
            });
#endif
        }
Esempio n. 4
0
        public ItemsViewModel()
        {
            Title = "Browse";
            Items = new ObservableRangeCollection <Item>();
            var task = ExecuteLoadItemsCommand();

            task.Wait();

#if __IOS__
            MessagingCenter.Subscribe <ItemNewViewController, Item>(this, "AddItem", async(obj, item) =>
            {
                var _item = item as Item;
                Items.Add(_item);
                await DataStore.AddItemAsync(_item);
            });
#elif __ANDROID__
            MessagingCenter.Subscribe <Android.App.Activity, Item>(this, "AddItem", async(obj, item) =>
            {
                var _item = item as Item;
                Items.Add(_item);
                await DataStore.AddItemAsync(_item);
            });
#else
            MessagingCenter.Subscribe <AddItems, Item>(this, "AddItem", async(obj, item) =>
            {
                var _item = item as Item;
                Items.Add(_item);
                await DataStore.AddItemAsync(_item);
            });
#endif
        }
        public ClientHomeViewModel()
        {
            Picture = new ObservableRangeCollection <Picture>();
            var image  = "https://i.ibb.co/V3jT8mt/pexels-photo-302083.jpg";
            var image2 = "https://i.ibb.co/7y8PnHC/pexels-photo-4262424.jpg";
            var image3 = "https://i.ibb.co/Hx8YrxR/pexels-photo-4473314.jpg";
            var image4 = "https://i.ibb.co/NpJqh7M/pexels-photo-1456951.jpg";
            var image5 = "https://i.ibb.co/1866fFQ/pexels-photo-1648358.jpg";

            Picture.Add(new Picture {
                Quote = "“The secret of your success is found in your daily routine.”", Image = image
            });
            Picture.Add(new Picture {
                Quote = "“You can rise up from anything. You can completely recreate yourself.”", Image = image2
            });
            Picture.Add(new Picture {
                Quote = "“Start thinking wellness, not illness”", Image = image3
            });
            Picture.Add(new Picture {
                Quote = "“Grow through what you go through.”", Image = image4
            });
            Picture.Add(new Picture {
                Quote = "“Your body can stand almost anything. It’s your mind that you have to convince.”", Image = image5
            });

            // animate to 75% progress over 500 milliseconds with linear easing
            // await progressBar.ProgressTo(0.75, 500, Easing.Linear);


            CurrentClient = new ObservableRangeCollection <Client>();

            PopulateClientDetails();
        }
        public SponsorDetailsViewModel(INavigation navigation, Sponsor sponsor) : base(navigation)
        {
            Sponsor = sponsor;
            if (!string.IsNullOrEmpty(sponsor.WebsiteUrl))
            {
                FollowItems.Add(new MenuItem
                {
                    Name      = "Web",
                    Subtitle  = sponsor.WebsiteUrl,
                    Parameter = sponsor.WebsiteUrl,
                    Icon      = "icon_website.png"
                });
            }

            if (!string.IsNullOrEmpty(sponsor.TwitterUrl))
            {
                FollowItems.Add(new MenuItem
                {
                    Name      = Device.RuntimePlatform == "iOS" ? "Twitter" : sponsor.TwitterUrl,
                    Subtitle  = $"@{sponsor.TwitterUrl}",
                    Parameter = "http://twitter.com/" + sponsor.TwitterUrl,
                    Icon      = "icon_twitter.png"
                });
            }
        }
Esempio n. 7
0
        public AllRecipeViewModel()
        {
            Recipes          = new ObservableRangeCollection <Recipe>();
            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());
            MessagingCenter.Subscribe <AddRecipePage, Recipe>(this, "AddItem", async(obj, item) =>
            {
                var _item        = item as Recipe;
                int currentTotal = DataStore.NumberRecipesInRecipesList();
                do
                {
                    _item.Id = currentTotal++;
                } while (await DataStore.GetRecipeAsync(_item.Id) != null);
                Recipes.Add(_item);
                await DataStore.AddRecipeAsync(_item);
                await App.Current.MainPage.DisplayAlert("Successful", "Added new recipe", "OK");
            });

            MessagingCenter.Subscribe <EditRecipePage, Recipe>(this, "EditItem", async(obj, item) =>
            {
                var _item = item as Recipe;
                await DataStore.UpdateRecipeAsync(_item);
                var _currentItem = Recipes.Where((Recipe args) => args.Id == _item.Id).FirstOrDefault();
                Recipes.Remove(_currentItem);
                Recipes.Add(_item);
            });
        }
        public MainChatViewModel()
        {
            // Initialize with default values
            ablyMessenger = DependencyService.Get <IAblyMessenger>();

            Messages = new ObservableRangeCollection <Message>();

            SendCommand = new Command(() =>
            {
                var message = new Message
                {
                    Text            = OutGoingText,
                    IsIncoming      = false,
                    MessageDateTime = DateTime.Now
                };


                Messages.Add(message);

                ablyMessenger?.SendMessage(message.Text);

                OutGoingText = string.Empty;
            });


            LocationCommand = new Command(async() =>
            {
                try
                {
                    var local = await CrossGeolocator.Current.GetPositionAsync(new TimeSpan(0, 0, 10));
                    var map   = $"https://maps.googleapis.com/maps/api/staticmap?center={local.Latitude.ToString(CultureInfo.InvariantCulture)},{local.Longitude.ToString(CultureInfo.InvariantCulture)}&zoom=17&size=400x400&maptype=street&markers=color:red%7Clabel:%7C{local.Latitude.ToString(CultureInfo.InvariantCulture)},{local.Longitude.ToString(CultureInfo.InvariantCulture)}&key=";

                    var message = new Message
                    {
                        Text            = "I am here",
                        AttachementUrl  = map,
                        IsIncoming      = false,
                        MessageDateTime = DateTime.Now
                    };

                    Messages.Add(message);
                    ablyMessenger?.SendMessage("attach:" + message.AttachementUrl);
                }
                catch (Exception ex)
                {
                }
            });


            if (ablyMessenger == null)
            {
                return;
            }

            ablyMessenger.MessageAdded = (message) =>
            {
                Messages.Add(message);
            };
        }
        /// <summary>
        /// Initializing Controls
        /// </summary>
        private void InitControls()
        {
            try
            {
                // Вкладка №0
                TrackNameTextBox.Text = $"Test track - ({DateTime.Now:HH:mm:ss dd.MM.yy})";
                _track             = new ImitationTrack();
                _track.Author      = "User1";
                _track.Description = "Put here your description...";

                _pinStart = new Pushpin {
                    Content = "A"
                };                                         // Start marker
                _pinEnd = new Pushpin {
                    Content = "B"
                };                                         // End marker
                _pinCar = new Pushpin                      // A marker for playing a route
                {
                    Content    = "->",
                    Background = new SolidColorBrush(Color.FromRgb(53, 196, 53))
                };

                NewGpsDevices         = new ObservableRangeCollection <GpsDevice>();
                TrackPositions        = new ObservableRangeCollection <TrackPosition>();
                OsrmWayPointsPushpins = new ObservableRangeCollection <DraggablePin>();

                NewImitationTrackGpsDevicesDataGrid.ItemsSource = NewGpsDevices;
                TrackPositionsDataGrid.ItemsSource   = TrackPositions;
                WayPointsForOsrmDataGrid.ItemsSource = OsrmWayPointsPushpins;

                NewGpsDevices.Add(new GpsDevice(0)
                {
                    Imei = "000002245678915"
                });
                NewGpsDevices.Add(new GpsDevice(0)
                {
                    Imei = "444555678154689"
                });

                foreach (var item in TabControlItems.Items)
                {
                    _tabItemsIsValidCollection.Add(new bool());
                }

                Player.Timer.Tick += Timer_Tick;
                Player.PlayerSlider.ValueChanged += PlayerSlider_ValueChanged;
                TrackPositions.CollectionChanged += TrackPositions_CollectionChanged;
                Player.CurrentPosition            = 0;

                CommonData.DataContext = _track;
                TotalView.DataContext  = _track;
            }
            catch (Exception exc)
            {
                LogWindowControl.AddMessage(exc.ToString());
            }
        }
Esempio n. 10
0
 public ModuleModel()
 {
     Voltages = new ObservableRangeCollection <double?>();
     BindingOperations.EnableCollectionSynchronization(Voltages, voltagesLock);
     Voltages.Add(null);
     Voltages.Add(null);
     Voltages.Add(null);
     Voltages.Add(null);
 }
        public MenuBarViewModel()
        {
            r_Menus = new ObservableRangeCollection<MenuItemViewModel>();
            Menus = new ReadOnlyObservableCollection<MenuItemViewModel>(r_Menus);

            r_Menus.Add(new BrowserMenuViewModel());
            r_Menus.Add(new ViewMenuViewModel());
            r_Menus.Add(new ToolMenuViewModel());
            r_Menus.Add(new HelpMenuViewModel());
        }
        public ExcerciseViewModel()
        {
            ObservableRangeCollection <Activitat> d0 = new ObservableRangeCollection <Activitat>();
            Activitat d1 = new Activitat();
            Activitat d2 = new Activitat();

            d0.Add(d1);
            d0.Add(d2);
            execlist = d0;
        }
Esempio n. 13
0
        /// <summary>
        /// HIDDEN Class constructor
        /// </summary>
        protected DirDiffDocSetupViewModel()
        {
            _IsRecursive         = true;
            _ShowOnlyInA         = true;
            _ShowOnlyInB         = true;
            _ShowIfDifferent     = true;
            _ShowIfSameFile      = true;
            _ShowIfSameDirectory = true;
            _CustomFilters       = new ObservableRangeCollection <string>();

            _IncludeFilter = true;
            _ExcludeFilter = false;

            _CustomFilters.Add("*.cs");
            _CustomFilters.Add("*.cs;*.xaml");
            _CustomFilters.Add("*.cpp;*.h;*.idl;*.rc;*.c;*.inl");
            _CustomFilters.Add("*.vb");
            _CustomFilters.Add("*.xml");
            _CustomFilters.Add("*.htm;*.html");
            _CustomFilters.Add("*.txt");
            _CustomFilters.Add("*.sql");
            _CustomFilters.Add("*.obj;*.pdb;*.exe;*.dll;*.cache;*.tlog;*.trx;*.FileListAbsolute.txt");

            _FileDiffMode = AehnlichDirViewModelLib.ViewModels.Factory.ConstructFileDiffModes();
        }
Esempio n. 14
0
        public MainChatViewModel()
        {
            // Initialize with default values
            messanger = new ClientWatsonAssistant();



            Messages = new ObservableRangeCollection <Message>();



            var welcomeMessage = new Message
            {
                Text            = messanger.CallConversation(""),
                IsIncoming      = false,
                MessageDateTime = DateTime.Now
            };

            Messages.Add(welcomeMessage);

            SendCommand = new Command(() =>
            {
                var message = new Message
                {
                    Text            = OutGoingText,
                    IsIncoming      = false,
                    MessageDateTime = DateTime.Now
                };


                Messages.Add(message);

                var incomingMessage = new Message
                {
                    Text            = messanger.CallConversation(message.Text),
                    IsIncoming      = true,
                    MessageDateTime = DateTime.Now
                };
                Messages.Add(incomingMessage);

                OutGoingText = string.Empty;
            });



            if (messanger == null)
            {
                return;
            }

            messanger.MessageAdded = (message) =>
            {
                Messages.Add(message);
            };
        }
Esempio n. 15
0
        public SessionDetailsViewModel(INavigation navigation, Session session)
            : base(navigation)
        {
            Session = session;
            if (Session.StartTime.HasValue)
            {
                ShowReminder = !Session.StartTime.Value.IsTba() &&
                               Session.EndTime.Value.ToUniversalTime() <= DateTime.UtcNow;
            }
            else
            {
                ShowReminder = false;
            }

#if DEBUG
            if (string.IsNullOrWhiteSpace(session.PresentationUrl))
            {
                session.PresentationUrl = "http://www.xamarin.com";
            }

            if (string.IsNullOrWhiteSpace(session.VideoUrl))
            {
                session.VideoUrl = "http://www.xamarin.com";
            }
#endif

            if (!string.IsNullOrWhiteSpace(session.PresentationUrl))
            {
                SessionMaterialItems.Add(
                    new MenuItem
                {
                    Name      = "Presentation Slides",
                    Parameter = session.PresentationUrl,
                    Icon      = "icon_presentation.png"
                });
            }

            if (!string.IsNullOrWhiteSpace(session.VideoUrl))
            {
                SessionMaterialItems.Add(
                    new MenuItem {
                    Name = "Session Recording", Parameter = session.VideoUrl, Icon = "icon_video.png"
                });
            }

            if (!string.IsNullOrWhiteSpace(session.CodeUrl))
            {
                SessionMaterialItems.Add(
                    new MenuItem {
                    Name = "Code from Session", Parameter = session.CodeUrl, Icon = "icon_code.png"
                });
            }
        }
Esempio n. 16
0
        public DietViewModel()
        {
            ObservableRangeCollection <Apat> d0 = new ObservableRangeCollection <Apat>();
            Apat d1 = new Apat();
            Apat d2 = new Apat();
            Apat d3 = new Apat();

            d0.Add(d1);
            d0.Add(d2);
            d0.Add(d3);
            dietaDay = d0;
        }
        private ObservableRangeCollection <Person> GetPeople()
        {
            ObservableRangeCollection <Person> people = new ObservableRangeCollection <Person>();

            people.Add(new Person {
                UserName = "******", Name = "Shelly Shmoo", Birthday = DateTime.Now, Email = "*****@*****.**", Id = 1, Phone = "666-555-8888"
            });
            people.Add(new Person {
                UserName = "******", Name = "Leanne Graham", Birthday = DateTime.Now, Email = "*****@*****.**", Id = 2, Phone = "666-555-8888"
            });

            return(people);
        }
Esempio n. 18
0
        public TabItemHomeViewModel()
        {
            Videos = new ObservableRangeCollection <Video>();

            Videos.Add(
                new Video
            {
                Link              = "https://www.ionixjunior.com.br/wp-content/uploads/2020/08/video1.mov",
                Description       = "Can’t believe I saw this #fyp #Chucky #scared #funny",
                AccountName       = "@emojiworld19",
                AccountAvatar     = "https://lh3.googleusercontent.com/a-/AOh14GgQzrEIrIO3xWk9rYpyNZSjUKocdDKhnvTP1VEPew=s96-c",
                IsVerifiedAccount = false,
                SongName          = "original sound - zodic_signszs12",
                SongAvatar        = "https://p16-tiktok-va-h2.ibyteimg.com/img/musically-maliva-obj/1658303418692613~c5_100x100.jpeg",
                Likes             = 1477,
                Messages          = 1718,
                Shares            = 137
            }
                );
            Videos.Add(
                new Video
            {
                Link              = "https://www.ionixjunior.com.br/wp-content/uploads/2020/08/video2.mp4",
                Description       = "New Orleans is wild #FeelTheFlip #SummerLooks #SNOOZZZAPALOOZA #BehindTheSong #BrowFitness #fyp",
                AccountName       = "@pudgiest",
                AccountAvatar     = "https://p16-tiktok-va-h2.ibyteimg.com/img/musically-maliva-obj/78c716e12210fc3cde6e37d7857ef292~c5_100x100.jpeg",
                IsVerifiedAccount = false,
                SongName          = "Gang Up(from \"The Fate of the Furious\") - Young Thug,2 Chainz,Wiz Khalifa",
                SongAvatar        = "https://p16-tiktok-sg-h2.ibyteimg.com/aweme/100x100/iesmusic-sg-local/v1/m/c150007f2c640e6b236.jpeg",
                Likes             = 19,
                Messages          = 9030,
                Shares            = 1071
            }
                );
            Videos.Add(
                new Video
            {
                Link              = "https://www.ionixjunior.com.br/wp-content/uploads/2020/08/video3.mp4",
                Description       = "How many dogs can you spot❓#SNOOZZZAPALOOZA #PhotoStory #MiracleCurlsChallenge #FeelTheFlip #foryoupage #goldenretriever #ellendegeneres",
                AccountName       = "@golden.retriever.trio",
                AccountAvatar     = "https://p16-tiktok-va-h2.ibyteimg.com/img/musically-maliva-obj/1663058121994246~c5_100x100.jpeg",
                IsVerifiedAccount = false,
                SongName          = "original sound - destinysciuva",
                SongAvatar        = "https://p16-tiktok-va-h2.ibyteimg.com/img/musically-maliva-obj/1663246946669574~c5_100x100.jpeg",
                Likes             = 1933,
                Messages          = 5109,
                Shares            = 345
            }
                );
        }
 private void FillStatusTypes()
 {
     StatusTypesList = new ObservableRangeCollection <StatusType>();
     StatusTypesList.Add(new StatusType
     {
         Code = "C",
         Name = "Completado"
     });
     StatusTypesList.Add(new StatusType
     {
         Code = "P",
         Name = "Pendiente"
     });
 }
Esempio n. 20
0
        public EntityListViewModel(
            IUnityContainer container,
            ViewModelsProvider provider)
            : base(container)
        {
            container.RegisterInstance(this);
            _provider        = provider;
            PropertyNames    = provider.GetEntityViewModel <TEntity>().PropertyNames;
            Filter           = PropertyNames.FirstOrDefault();
            EntityViewModels = new ObservableRangeCollection <EntityViewModelBase <TEntity> >();
            var crud = container.Resolve <ICrud <TEntity> >();

            if (crud.LocalEntities != null)
            {
                crud.LocalEntities.CollectionChanged += LocalEntitiesOnCollectionChanged;

                foreach (var entity in crud.LocalEntities)
                {
                    var viewModel = _provider.GetEntityViewModel(entity);
                    EntityViewModels.Add(viewModel);
                }
            }

            CollectionView        = (ListCollectionView)CollectionViewSource.GetDefaultView(EntityViewModels);
            CollectionView.Filter = EntityFilter;
        }
Esempio n. 21
0
        public MainPageViewModel()
        {
            Pedidos = new ObservableRangeCollection <Pedido>();
            Pedido  = new Pedido();

            var ip = "localhost";

            if (Device.RuntimePlatform == Device.Android)
            {
                ip = "10.0.2.2";
            }

            hubConnection = new HubConnectionBuilder()
                            .WithUrl($"http://{ip}:5000/pedidosHub")
                            .Build();


            hubConnection.On <string, Pedido>("ReceberPedido", (user, pedido) =>
            {
                if (user == "Test")
                {
                    Pedidos.Add(pedido);
                }
            });

            EnviarPedidoCommand = new Command(async() =>
            {
                await EnviarPedido(Pedido.Nome, Pedido);
            });
        }
Esempio n. 22
0
        private async Task LoadProductCategory(object value)
        {
            CategorizedProducts cp = value as CategorizedProducts;

            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var result = await ProductsService.GetProductByCategory(cp.Name);

                AllProducts.Clear();
                result.ToList().ForEach(p => AllProducts.Add(p));
                await Application.Current.MainPage.Navigation.PushAsync(new ShowAllProductsPage(AllProducts));
            }

            catch (Exception e)
            {
                Debug.WriteLine(e);
            }

            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 23
0
        /// <summary>
        /// Temp colour code. As stated above should be driven from service.
        /// </summary>
        /// <param name="backingStore">Value to update</param>
        /// <param name="value">The new value</param>
        /// <param name="colour">Which colour is this</param>
        private void ToggleColour(ref bool backingStore, bool value, ColourEnum colour)
        {
            // Update the property on this VM
            SetProperty(ref backingStore, value);

            // Copy the existing colours to a new object so we can force an update (and trigger the binding to update)
            var colours = new ObservableRangeCollection <Colour>();

            colours.AddRange(this.Person.Colours);

            // Also ensure the colours in the person's colour collection is correct
            if (value)
            {
                // The colour must be present
                if (!colours.Where(c => c.Id == (int)colour).Any())
                {
                    colours.Add(new Colour()
                    {
                        Id = (int)colour, Name = colour.ToString()
                    });
                }
            }
            else
            {
                // Make sure the colour is not there
                var existingColour = colours.FirstOrDefault(c => c.Id == (int)colour);
                if (existingColour != null)
                {
                    colours.Remove(existingColour);
                }
            }

            // Update the colour collection and trigger the refresh
            this.Person.Colours = colours;
        }
Esempio n. 24
0
 private void P_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == @"IsVisible")
     {
         var p = (Waypoint)sender;
         if (p.IsVisible)
         {
             _visibleWaypoints.Add(p);
         }
         else
         {
             _visibleWaypoints.Remove(p);
         }
     }
     else if (e.PropertyName == @"IsSelected")
     {
         var p = (Waypoint)sender;
         if (p.IsSelected)
         {
             _selectedWaypoints.Add(p);
         }
         else
         {
             _selectedWaypoints.Remove(p);
         }
     }
 }
Esempio n. 25
0
        public ChatViewModel()
        {
            messanger = DependencyService.Get <IMessanger>();
            Messages  = new ObservableRangeCollection <Message>();

            SendCommand = new Command(() =>
            {
                var message = new Message
                {
                    Text    = OutGoingText,
                    OutOrIn = true
                };

                Messages.Add(message);
                messanger?.SendMessage(message.Text);
                OutGoingText = string.Empty;
            });

            //if (messanger == null)
            //{
            //    return;
            //}

            //messanger.MessageAdded = (message) =>
            //{
            //    Messages.Add(message);
            //};
        }
Esempio n. 26
0
        private void ConfigureForRemoval()
        {
            var itemsToRemove = new ObservableRangeCollection <BaseMenuItemViewModel> ();

            // Update each item in the list
            foreach (BaseMenuItemViewModel viewModel in ItemViewModels)
            {
                if (viewModel.MenuItemType == MenuItemType.Added)
                {
                    viewModel.MenuItemType = MenuItemType.Remove;
                }
                else
                {
                    itemsToRemove.Add(viewModel);
                }
            }

            // Remove the items that aren't editable
            if (itemsToRemove.Count > 0)
            {
                foreach (BaseMenuItemViewModel viewModel in itemsToRemove)
                {
                    ItemViewModels.Remove(viewModel);
                }
            }

            // Toggle the visibility of the "All accounts are removed" text
            ShowSubtitle = ItemViewModels.Count == 0;
        }
 public EventDetailsViewModel(INavigation navigation, FeaturedEvent e) : base(navigation)
 {
     Event = e;
     Sponsors = new ObservableRangeCollection<Sponsor>();
     if (e.Sponsor != null)
         Sponsors.Add(e.Sponsor);
 }
Esempio n. 28
0
        public void BindData()
        {
            GroupedItems = new ObservableRangeCollection <LoggTypeGrouping>();

            var loggTypeGroups    = App.Database.GetLoggTypeGroups();
            var loggTyper         = App.Database.GetLoggTyper();
            var selectedLoggTyper = App.Database.GetSelectedLoggTyper();

            foreach (var g in loggTypeGroups)
            {
                var loggTyperInGroup = loggTyper.Where(a => a.GroupId == g.ID);

                if (loggTyperInGroup.Any())
                {
                    var ag = new LoggTypeGrouping(g.Navn, "");

                    foreach (var loggType in loggTyperInGroup)
                    {
                        loggType.Selected = selectedLoggTyper.Select(s => s.Key).Contains(loggType.Key);
                        ag.Add(loggType);
                    }

                    GroupedItems.Add(ag);
                }
            }
        }
        public EntregasLPViewModel()
        {
            Title            = "Ventas";
            Items            = new ObservableRangeCollection <Entrega>();
            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());

            //MessagingCenter.Subscribe<EntregaNuevoPage, Entrega>(this, "Entrega_Crear", async (obj, item) =>
            MessagingCenter.Subscribe <EntregaCreacionViewModel, Entrega>(this, "Entrega_Crear", async(obj, item) =>
            {
                try
                {
                    var _item = item as Entrega;
                    //if(await (DataStore as EntregasDataSource).AddItemAsync(_item,obj._stock ))
                    if (await App.EntregaDB.SaveItem(_item, obj._stock))
                    {
                        Items.Add(_item);
                        //Items = Items.OrderByDescending(i => i.Fecha);
                        //IDataStore<Producto> ProducDS = DependencyService.Get<IDataStore<Producto>>();
                        //((PProductosDataSource)ProducDS).ForceRefreshCollection();
                        //MessagingCenter.Send(this, "Entrega_Creada", resu);
                    }
                }
                catch (Exception e)
                {
                }
            });
        }
Esempio n. 30
0
        /// <summary>
        /// ターゲットの <see cref="LifeCycleLog"/> を作成し、管理対象とする
        /// </summary>
        public LifeCycleLog CreateLifeCycleLog(object target, Guid guid)
        {
            var log = new LifeCycleLog(target, guid);

            LifeCycleLogs.Add(log);
            return(log);
        }
        public AccountsObservableRangeCollection(ObservableRangeCollection<ArticleProperty> obj, string recordDayStr="")
        {
            if (((ObservableRangeCollection<ArticleProperty>)obj).Count() == 0)
            {
                AccountsList = new ObservableRangeCollection<ArticleProperty>
                        {
                            new ArticleProperty("На руках",1),
                            new ArticleProperty("Сбербанк",2),
                        };
                SetRecordDayStr();
                return;
            }

            AccountsList = new ObservableRangeCollection<ArticleProperty>();

            foreach (ArticleProperty aP in obj)
                AccountsList.Add(new ArticleProperty
                {
                    ID = aP.ID,
                    Name = aP.Name,
                    TapNumber = aP.TapNumber,
                    Summ = aP.Summ
                });
            if(recordDayStr=="")
                SetRecordDayStr();
            else
                RecordDayStr = recordDayStr;
        }
Esempio n. 32
0
 public LearnChatViewModel(INavigationService navigationService, IPageDialogService dialogService) : base(navigationService, dialogService)
 {
     TestChatClass = new ObservableRangeCollection <TestChat>();
     TestChatClass.Add(new TestChat {
         ChatBackgroundColor = Color.FromHex("#41c9ff"), ChatCornerRadious = new CornerRadius(15, 15, 15, 0), ChatText = "Hi"
     });
     TestChatClass.Add(new TestChat {
         ChatBackgroundColor = Color.FromHex("#af6dec"), ChatCornerRadious = new CornerRadius(0, 15, 15, 15), ChatText = "Welcome"
     });
     TestChatClass.Add(new TestChat {
         ChatBackgroundColor = Color.FromHex("#41c9ff"), ChatCornerRadious = new CornerRadius(15, 15, 15, 0), ChatText = "How are you ?"
     });
     TestChatClass.Add(new TestChat {
         ChatBackgroundColor = Color.FromHex("#af6dec"), ChatCornerRadious = new CornerRadius(0, 15, 15, 15), ChatText = "Doing great! Thanks for asking."
     });
 }
Esempio n. 33
0
        public WatchVM()
        {
            WatchProjects = new ObservableRangeCollection <Project>();

            var range = new List <Project>(App.DBWatch.GetItems());

            WatchProjects.AddRange(range);

            //fixes indicators when page loads 1st time
            foreach (var p in WatchProjects)
            {
                p.IsBusy = false;
            }

            MessagingCenter.Subscribe <Project>(this, "MsgAddWatchProject", (project) =>
            {
                App.DBWatch.SaveItem(project);
                WatchProjects.Add(project);

                Fetch(project);
            });

            FetchCommand = new Command(Fetch);

            WatchAddCommand = new Command(async() => {
                await Navigation.PushAsync(new WatchAddPage(new Project()));
            });

            WatchDeleteCommand = new Command(Delete);
        }
        /// <summary>
        /// Initializes a new instance of the WalletViewModel class.
        /// </summary>
        public WalletCardsLayoutViewModel(IDataService dataService, ISettingsService settingsService)
        {
            DataService = dataService;
            SettingsService = settingsService;
            BankCards = new ObservableRangeCollection<Card>();
            CashCards = new ObservableRangeCollection<Card>();
            NewCashCard = new Card();

#if DEBUG
            if (IsInDesignMode)
            {
                var testBankCard = new Card()
                {
                    Type = CardType.Bank,
                    CardNumber = "XXXX XXXX XXXX 1234",
                    BankId = 7,
                    Bank = new Bank()
                    {
                        Id = 7,
                        Name = "Альфа банк"
                    },
                    Balance = 341.2
                };
                BankCards.Add(testBankCard);
                BankCards.Add(testBankCard);

                var testCashCard = new Card()
                {
                    Type = CardType.Cash,
                    Title = "На куртизанок",
                    Balance = 342.1,
                    UpdatedAt = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds
                };
                CashCards.Add(testCashCard);
                CashCards.Add(testCashCard);

                IcontoWallet = new Iconto.PCL.Services.Data.REST.Entities.Wallet()
                {
                    Balance = 4324234.34
                };
                IcontoCashback = new Card()
                {
                    Balance = 3423.52
                };
            }
#endif
        }
Esempio n. 35
0
		void Initialize()
		{
			Lines = new ObservableRangeCollection<LineViewModel>();
			foreach (var line in Configuration.Lines)
			{
				var lineViewModel = new LineViewModel(line);
				Lines.Add(lineViewModel);
			}
            RenameLines();
			SelectedLine = Lines.FirstOrDefault();
		}
 public AccountsObservableRangeCollection(IOrderedEnumerable<ArticleProperty> obj)
 {
     AccountsList = new ObservableRangeCollection<ArticleProperty>();
     foreach (ArticleProperty aP in obj)
         AccountsList.Add(new ArticleProperty
         {
             ID=aP.ID,
             Name = aP.Name,
             TapNumber = aP.TapNumber,
             Summ = aP.Summ
         });
     this.SetRecordDayStr();
 }
Esempio n. 37
0
		void CopyProperties(HexFileCollectionInfo hexFileCollectionInfo)
		{
			SelectedDriver = hexFileCollectionInfo.DriverType;
			Name = hexFileCollectionInfo.Name;
			MinorVersion = hexFileCollectionInfo.MinorVersion;
			MajorVersion = hexFileCollectionInfo.MajorVersion;
			AutorName = hexFileCollectionInfo.AutorName;

			Files = new ObservableRangeCollection<FileViewModel>();
			foreach (var fileInfo in hexFileCollectionInfo.FileInfos)
			{
				var fileViewModel = new FileViewModel(fileInfo, false);
				Files.Add(fileViewModel);
				SelectedFile = Files.FirstOrDefault();
			}
		}
Esempio n. 38
0
		void Initialize(HexFileCollectionInfo hexFileCollectionInfo)
		{
			Name = hexFileCollectionInfo.Name;
			MinorVersion = hexFileCollectionInfo.MinorVersion;
			MajorVersion = hexFileCollectionInfo.MajorVersion;
			AvailableDriverTypes = new ObservableCollection<XDriverType>()
		    { 
				XDriverType.GK, XDriverType.KAU, XDriverType.RSR2_KAU
			};
			HexFileViewModels = new ObservableRangeCollection<HexFileViewModel>();
			foreach (var hexFileInfo in hexFileCollectionInfo.HexFileInfos)
			{
				AvailableDriverTypes.Remove(AvailableDriverTypes.FirstOrDefault(x => x == hexFileInfo.DriverType));
				HexFileViewModels.Add(new HexFileViewModel(hexFileInfo));
			}
			SelectedHexFile = HexFileViewModels.FirstOrDefault();
			SelectedDriverType = AvailableDriverTypes.FirstOrDefault();
		}
 private void AddOrUpdateExistent(ObservableRangeCollection<GroupInfoList<object>> _groupsByLetter, GroupInfoList<object> info)
 {
     // TODO convert to linq
     foreach (GroupInfoList<object> gr in _groupsByLetter)
     {
         if (gr.Key.Equals(info.Key))
         {
             gr.AddRange(info);
             return;
         }
     }
     _groupsByLetter.Add(info);
 }
Esempio n. 40
0
        public static void SetCurrentAccountsStatusToList(double n)
        {
            //Для отладки
            var ISD = new IsolatedStorageDeserializer<ObservableRangeCollection<AccountsObservableRangeCollection>>();

            var listForDeserialize = new ObservableRangeCollection<AccountsObservableRangeCollection>();
            listForDeserialize.Add(new AccountsObservableRangeCollection(CurrentData.ArtAccountList.AccountsList
                                , (new AccountsObservableRangeCollection()).SetRecordDayStr((int)n)));

            ISD.XmlSerialize(listForDeserialize, DateTime.Today.AddDays(-(int)n).ToString("M.y"), true, CurrentData.AppMode + "\\" + "AccountStatuses");
        }
 private void _Initialize(FolderModel newFolder)
 {
     #region //Присваеваем анонимные функции коммандам
     SetRenameEnableCommand = new Command(arg => IsNameReadOnly = !Convert.ToBoolean(arg));
     SetRenameEnableCommand.CanExecuteDelegate = arg => this.GetType() == typeof(FolderViewModel);
     CreateSubFolderCommand = new Command(arg => {
         string name = FullName + "\\" + "Новая папка";
         string newName = name;
         for (int i = 1; Directory.Exists(newName); ++i)
             newName = name + " (" + i.ToString() + ")";
         FileSystem.CreateDirectory(newName);
     });
     DeleteCommand = new Command(arg => Task.Run(() => FileSystem.DeleteDirectory(FullName, UIOption.AllDialogs, RecycleOption.SendToRecycleBin, UICancelOption.DoNothing)));
     CopyCommand = new Command(arg =>
     {
         foreach (var folder in DriveViewModel.CutedFolders)
             folder.IsCuted = false;
         DriveViewModel.CutedFolders.Clear();
         StringCollection folderPath = new StringCollection();
         folderPath.Add(FullName);
         Clipboard.SetFileDropList(folderPath);
         FileSystemViewModel.IsClipBoardItemsCuted = false;
     });
     CopyCommand.CanExecuteDelegate = arg => this.GetType() == typeof(FolderViewModel);
     CutCommand = new Command(arg =>
     {
         IsCuted = true;
         foreach (var folder in DriveViewModel.CutedFolders)
             folder.IsCuted = false;
         DriveViewModel.CutedFolders.Clear();
         StringCollection folderPath = new StringCollection();
         DriveViewModel.CutedFolders.Add(this);
         folderPath.Add(FullName);
         Clipboard.SetFileDropList(folderPath);
         FileSystemViewModel.IsClipBoardItemsCuted = true;
     });
     CutCommand.CanExecuteDelegate = new Predicate<object>(arg => this.GetType() == typeof(FolderViewModel));
     DeleteFilesCommand = new Command(arg => { foreach (var file in FolderFilesCollectionView.SelectedItems) file.Delete(); });
     DeleteCommand.CanExecuteDelegate = new Predicate<object>(arg => this.GetType() == typeof(FolderViewModel));
     OpenFilesCommand = new Command(arg => {
         foreach (var file in FolderFilesCollectionView.SelectedItems) file.Open();
     });
     CopyFilesCommand = new Command(arg =>
     {
         foreach (var file in DriveViewModel.CutedFiles)
             file.IsCuted = false;
         DriveViewModel.CutedFiles.Clear();
         StringCollection filePaths = new StringCollection();
         foreach (var file in FolderFilesCollectionView.SelectedItems)
             filePaths.Add(file.FullName);
         Clipboard.SetFileDropList(filePaths);
         FileSystemViewModel.IsClipBoardItemsCuted = false;
     });
     CutFilesCommand = new Command(arg =>
     {
         foreach (var file in DriveViewModel.CutedFiles)
             file.IsCuted = false;
         DriveViewModel.CutedFiles.Clear();
         StringCollection filePaths = new StringCollection();
         foreach (var file in FolderFilesCollectionView.SelectedItems)
         {
             DriveViewModel.CutedFiles.Add(file);
             file.IsCuted = true;
             filePaths.Add(file.FullName);
         }
         Clipboard.SetFileDropList(filePaths);
         FileSystemViewModel.IsClipBoardItemsCuted = true;
     });
     SortFilesCommand = new Command(arg =>
     {
         if (_ListSortDirection == ListSortDirection.Descending) _ListSortDirection = ListSortDirection.Ascending;
         else _ListSortDirection = ListSortDirection.Descending;
         if (arg.ToString() == "Size")
         {
             FolderFilesCollectionView.CustomSort = new FileSizeSorter(_ListSortDirection);
         }
         else if (arg.ToString() == "LastWriteTime")
         {
             FolderFilesCollectionView.CustomSort = new DateTimeSorter(_ListSortDirection);
         }
         else
         {
             FolderFilesCollectionView.SortDescriptions.Clear();
             FolderFilesCollectionView.CustomSort = null;
             FolderFilesCollectionView.SortDescriptions.Add(new SortDescription(arg.ToString(), _ListSortDirection));
         }
     });
     PasteCommand = new Command(arg => Paste(Clipboard.GetFileDropList(), FullName, FileSystemViewModel.IsClipBoardItemsCuted));
     PasteCommand.CanExecuteDelegate = arg => Clipboard.ContainsFileDropList();
     FindCommand = new Command(arg => FolderFilesCollectionView.Filter = new Predicate<object>(item =>
         (((FileViewModel)item).Name.ToLower() + ((FileViewModel)item).Extension.ToLower()).Contains(arg.ToString().ToLower())));
     RenameCommand = new Command(arg =>
     {
         if (arg.ToString() != Name)
             try { FileSystem.RenameDirectory(FullName, arg.ToString()); }
             catch (ArgumentException)
             {
                 NotifyPropertyChanged("Name");
                 IsWrongName = true;
             }
             catch (DirectoryNotFoundException) { }
     });
     #endregion
     _SubFoldersClearTimer.Elapsed += _OnSubFoldersClearTimerElapsed;
     Name = newFolder.DirInfo.Name;
     FullName = newFolder.DirInfo.FullName;
     SubFolders = new ObservableRangeCollection<FolderViewModel>();
     FolderFiles = new ObservableRangeCollection<FileViewModel>();
     try { if (Directory.GetDirectories(FullName).Length != 0) SubFolders.Add(null); }
     catch { }
     FolderFilesCollectionView = new MultiSelectCollectionView<FileViewModel>(FolderFiles);
 }
Esempio n. 42
0
		public async Task GetPosts ()
		{
			var facebookViewModels = await GetFacebookFeed();
			var twitterViewModels = await GetTwitterFeed ();

			var allViewModels = new ObservableRangeCollection<BaseContentCardViewModel> ();

			// TODO: Need to further develop this system of ordering
			// Need to be able to toggle between popularity and time
			//			allViewModels.AddRange (facebookViewModels);
			//			allViewModels.AddRange (twitterViewModels);

			Random rnd = new Random();

			int total = facebookViewModels.Count + twitterViewModels.Count;
			double fbLuck = 0;
			double tLuck = 0;

			fbLuck = facebookViewModels.Count/(double) total;
			tLuck = twitterViewModels.Count/(double) total;

			for (int i = 0; i < total; i++)
			{
				int newTotal = 0;
				var dicey = rnd.NextDouble();
				if (dicey < fbLuck)
				{
					allViewModels.Add(facebookViewModels.First());
					facebookViewModels.RemoveAt(0);
				}
				else
				{
					allViewModels.Add(twitterViewModels.First());
					twitterViewModels.RemoveAt(0);
				}
				newTotal = facebookViewModels.Count + twitterViewModels.Count;
				if (newTotal != 0)
				{
					fbLuck = facebookViewModels.Count/(double) newTotal;
					tLuck = twitterViewModels.Count/(double) newTotal;
				}
			}



			//
			//			if(OrderBy == OrderBy.Time)
			//			{
			//				allViewModels = new ObservableRangeCollection<BaseContentCardViewModel> (allViewModels.OrderByDescending (vm => vm.OrderByDateTime));
			//			}
			//
			CardViewModels.Clear ();
			CardViewModels.AddRange (allViewModels);

			foreach (BaseContentCardViewModel viewModel in CardViewModels)
			{
				viewModel.RequestMovieViewer = RequestMovieViewer;
				viewModel.RequestPhotoViewer = RequestPhotoViewer;
                viewModel.RequestCommentPage = OnRequestCommentPage;
			}

			IsRefreshing = false;

			if(RequestCompleted != null) {
				RequestCompleted ();
			}
		}
Esempio n. 43
0
		private void ConfigureForRemoval ()
		{
			var itemsToRemove = new ObservableRangeCollection<BaseMenuItemViewModel> ();

			// Update each item in the list
			foreach (BaseMenuItemViewModel viewModel in ItemViewModels) {
				if(viewModel.MenuItemType == MenuItemType.Added) {
					viewModel.MenuItemType = MenuItemType.Remove;

				} else {
					itemsToRemove.Add (viewModel);
				}
			}

			// Remove the items that aren't editable
			if(itemsToRemove.Count > 0) {
				foreach(BaseMenuItemViewModel viewModel in itemsToRemove) {
					ItemViewModels.Remove (viewModel);
				}
			}

			// Toggle the visibility of the "All accounts are removed" text
			ShowSubtitle = ItemViewModels.Count == 0;
		}