public static ObservableRangeCollection<ArticleProperty> ArticlePropertyListDeserialize(string property)
        {
            var ArtPropList = new ObservableRangeCollection<ArticleProperty>();

            var ISD = new IsolatedStorageDeserializer<ObservableRangeCollection<ArticleProperty>>();

            ArtPropList = ISD.XmlDeserialize(property,  CurrentData.AppMode);
            if (ArtPropList == null)
                switch (property)
                {
                    case "Income":
                        ArtPropList = new ObservableRangeCollection<ArticleProperty>
                        {
                            new ArticleProperty("Зарплата",1),
                            new ArticleProperty("Подработка",2),
                        };
                        break;
                    case "Outlay":
                        ArtPropList = new ObservableRangeCollection<ArticleProperty>
                        {
                            new ArticleProperty("Продукты",-1),
                            new ArticleProperty("За квартиру",-2),
                        };
                        break;
                    default:
                        ArtPropList = new ObservableRangeCollection<ArticleProperty>();
                        break;
                }
            return ArtPropList;
        }
Esempio n. 2
0
        private async Task LoadTagsAsync ()
        {
            TagCollection = new ObservableRangeCollection<TagData> ();
            var store = ServiceContainer.Resolve<IDataStore> ();

            var workspaceTags = await store.Table<TagData> ()
                                .Where (r => r.DeletedAt == null && r.WorkspaceId == workspaceId)
                                .ToListAsync();
            var currentSelectedTags = await store.Table<TagData> ()
                                      .Where (r => r.DeletedAt == null && previousSelectedIds.Contains (r.Id))
                                      .ToListAsync();

            // TODO:
            // There is an strange case, tags are created again across
            // workspaces. To avoid display similar names
            // on the list the diff and corrupt data, the filter is done by
            // names. The bad point is that tags will appears unselected.
            var diff = currentSelectedTags.Where (sTag => workspaceTags.All (wTag => sTag.Name != wTag.Name));

            workspaceTags.AddRange (diff);

            workspaceTags.Sort ((a, b) => {
                var aName = a != null ? (a.Name ?? String.Empty) : String.Empty;
                var bName = b != null ? (b.Name ?? String.Empty) : String.Empty;
                return String.Compare (aName, bName, StringComparison.Ordinal);
            });

            TagCollection.AddRange (workspaceTags);
        }
Esempio n. 3
0
 public StoresViewModel(Page page) : base(page)
 {
     Title = "Locations";
     dataStore = DependencyService.Get<IDataStore>();
     Stores = new ObservableRangeCollection<Store>();
     StoresGrouped = new ObservableRangeCollection<Grouping<string, Store>>();
 }
Esempio n. 4
0
		public MainViewModel()
		{
			CreateNewCommand = new RelayCommand(OnCreateNew);
			AddFileCommand = new RelayCommand(OnAddFile);
			RemoveFileCommand = new RelayCommand(OnRemoveFile, CanRemoveFile);
			SaveFileCommand = new RelayCommand(OnSaveFile, CanSaveFile);
			LoadFileCommand = new RelayCommand(OnLoadFile);
			Files = new ObservableRangeCollection<FileViewModel>();

			Drivers = new ObservableCollection<DriverType>();
			Drivers.Add(DriverType.Rubezh_2AM);
			Drivers.Add(DriverType.Rubezh_4A);
			Drivers.Add(DriverType.Rubezh_2OP);
			Drivers.Add(DriverType.BUNS);
			Drivers.Add(DriverType.IndicationBlock);
			Drivers.Add(DriverType.PDU);
			Drivers.Add(DriverType.PDU_PT);
			Drivers.Add(DriverType.MS_1);
			Drivers.Add(DriverType.MS_2);
			Drivers.Add(DriverType.MS_3);
			Drivers.Add(DriverType.MS_4);
			Drivers.Add(DriverType.UOO_TL);

			OnCreateNew();
		}
        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;
        }
 public EventDetailsViewModel(INavigation navigation, FeaturedEvent e) : base(navigation)
 {
     Event = e;
     Sponsors = new ObservableRangeCollection<Sponsor>();
     if (e.Sponsor != null)
         Sponsors.Add(e.Sponsor);
 }
Esempio n. 7
0
        public ProductsGridControl()
        {
            _GridViewResult = new ObservableRangeCollection<ProductGridViewModel>();
            _GridViewResult.CollectionChanged += Result_CollectionChanged;
            InitializeComponent();
            InitializeProductsGrid();
            ProductDetailCtrl.CloseModalBtn.Click += CloseModalBtn_Click;

        }
        public DevelopmentHistoryViewModel()
        {
            Title = StringResources.Instance.Main.Window_DevelopmentHistory;

            r_Records = new ObservableRangeCollection<DevelopmentRecord.RecordItem>();
            Records = new ReadOnlyObservableCollection<DevelopmentRecord.RecordItem>(r_Records);

            r_NewRecordSubscription = DevelopmentRecord.NewRecord.ObserveOnDispatcher().Subscribe(r => r_Records.Insert(0, r));
        }
        internal EquipmentTypeGroupViewModel(EquipmentInfo rpInfo, EquipmentTypeViewModel rpType, IEnumerable<Equipment> rpEquipments)
        {
            Info = rpInfo;
            Type = rpType;
            Levels = new ObservableRangeCollection<EquipmentLevelGroupViewModel>();

            var rLevels = rpEquipments.GroupBy(r => r.Level).OrderBy(r => r.Key).Select(r => new EquipmentLevelGroupViewModel(r.Key, r, Info));
            DispatcherUtil.UIDispatcher.BeginInvoke(new Action<IEnumerable<EquipmentLevelGroupViewModel>>(Levels.AddRange), rLevels);
        }
        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 MenuItemViewModel(string rpText, ICommand rpCommand)
        {
            Title = rpText;
            Command = rpCommand;

            r_Items = new ObservableRangeCollection<object>();

            var rItems = CreateMenuItems();
            if (rItems != null)
                r_Items.AddRange(rItems);
        }
Esempio n. 12
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();
 }
        public EquipmentLevelGroupViewModel(int rpLevel, IEnumerable<Equipment> rpEquipments, EquipmentInfo rpInfo)
        {
            Level = rpLevel;
            Count = rpEquipments.Count();
            Info = rpInfo;
            EquipedShips = new ObservableRangeCollection<EquipedShipViewModel>();

            Task.Run(() =>
            {
                var rData = App.Root.Game.Ships.Ships.Select(r => new EquipedShipViewModel(r, r.Model.Slots.Count(rpSlot => rpSlot.Equipment.Info == Info && rpSlot.Equipment.Level == Level))).Where(r => r.Count > 0);
                DispatcherUtil.UIDispatcher.BeginInvoke(new Action<IEnumerable<EquipedShipViewModel>>(EquipedShips.AddRange), rData);
            });
        }
Esempio n. 15
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();
			}
		}
        /// <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. 17
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();
		}
        public FriendsViewModel()
        {
            ViewFriendCodeCommand = new AsyncCommand <string>(ViewFriendCode);
            Friends        = new ObservableRangeCollection <FriendStatus>();
            FriendsGrouped = new ObservableRangeCollection <FriendGroup>();
            RegisterFriendClipboardCommand = new AsyncCommand(RegisterFriendClipboard);
            RegisterFriendCommand          = new AsyncCommand <string>(RegisterFriend);
            RefreshCommand           = new AsyncCommand(RefreshAsync);
            SendFriendRequestCommand = new AsyncCommand <Xamarin.Forms.View>(SendFriendRequest);
            RemoveFriendCommand      = new AsyncCommand <FriendStatus>(RemoveFriend);
            GoToFriendRequestCommand = new AsyncCommand(GoToFriendRequest);
            var cache = DataService.GetCache <IEnumerable <FriendStatus> >(DataService.FriendKey);

            if (cache != null)
            {
                Friends.ReplaceRange(cache.OrderByDescending(s => s.TurnipUpdateTimeUTC));
                UpdateFriendsGroups();
            }
        }
        public void GroupingTestCase()
        {

            var grouped = new ObservableRangeCollection<Grouping<string, Person>>();
            var people = new[]
            { 
                new Person { FirstName = "Joseph", LastName = "Hill" },
                new Person { FirstName = "James", LastName = "Montemagno" },
                new Person { FirstName = "Pierce", LastName = "Boggan" },
            };

            var sorted = from person in people
                                  orderby person.LastName
                                  group person by person.SortName into personGroup
                                  select new Grouping<string, Person>(personGroup.Key, personGroup);

            grouped.AddRange(sorted);
           
        }
Esempio n. 20
0
        public ChatViewModel()
        {
            Messages = new ObservableRangeCollection <Message>();

            InitializeMock();

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

                Messages.Add(message);
                OutGoingText = string.Empty;
            });
        }
Esempio n. 21
0
        public SettingsPageViewModel()
        {
            _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _cryptoService        = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _stateService         = ServiceContainer.Resolve <IStateService>("stateService");
            _deviceActionService  = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _environmentService   = ServiceContainer.Resolve <IEnvironmentService>("environmentService");
            _messagingService     = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _vaultTimeoutService  = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _syncService          = ServiceContainer.Resolve <ISyncService>("syncService");
            _biometricService     = ServiceContainer.Resolve <IBiometricService>("biometricService");
            _policyService        = ServiceContainer.Resolve <IPolicyService>("policyService");
            _localizeService      = ServiceContainer.Resolve <ILocalizeService>("localizeService");
            _keyConnectorService  = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService");
            _clipboardService     = ServiceContainer.Resolve <IClipboardService>("clipboardService");

            GroupedItems = new ObservableRangeCollection <ISettingsPageListItem>();
            PageTitle    = AppResources.Settings;
        }
Esempio n. 22
0
 private void SetEditableControls()
 {
     _upDownAmount.Value        = 0.00M;
     _observableFrequencies     = new ObservableRangeCollection <Frequency>(Service.Frequencies);
     _cbFrequent.ItemsSource    = _observableFrequencies;
     _observableImportances     = new ObservableRangeCollection <Importance>(Service.Importances);
     _cbImportance.ItemsSource  = _observableImportances;
     _observableTransactionType = new ObservableRangeCollection <TransactionType>(Service.TransactionTypes);
     _cbTransaction.ItemsSource = _observableTransactionType;
     _observableTransferType    = new ObservableRangeCollection <TransferType>(Service.TransferTypes);
     _cbTransfer.ItemsSource    = _observableTransferType;
     _observableGroups          = new ObservableRangeCollection <OperationsGroup> {
         null
     };
     _observableGroups.AddRange(Service.OperationsGroups);
     _cbRelated.ItemsSource = _observableGroups;
     _observableTags        = new ObservableRangeCollection <Tag>(Service.Tags);
     _cbTags.ItemsSource    = _observableTags;
 }
Esempio n. 23
0
        /// <summary>
        /// Function to filter interests
        /// </summary>
        ObservableRangeCollection <Interest> FilteredRecords(string NewTextValue)
        {
            ObservableRangeCollection <Interest> filter = new ObservableRangeCollection <Interest>();

            MainThread.BeginInvokeOnMainThread(() =>
            {
                for (int i = 0; i < Interests.Count; i++)
                {
                    Interest _interest = Interests[i];

                    if (_interest.Title.ToLower().Contains(NewTextValue.ToLower()))
                    {
                        filter.Add(_interest);
                    }
                }
            });

            return(filter);
        }
Esempio n. 24
0
        public EcommerceDashboardViewModel(ISqlService localSql, DateTime startTime)
        {
            this.localSql = localSql;
            ReportData    = new ObservableRangeCollection <MessageSummaryModel>();
            SearchData    = new MessageSearchModel
            {
                CreatedFrom = startTime,
                CreatedTo   = DateTime.Today.AddDays(1),
            };

            SubmitCommand     = new BaseCommand(LoadReport);
            ProcessingCommand = new BaseCommand(ViewProcessing);
            ErrorCommand      = new BaseCommand(ViewError);
            SuccessCommand    = new BaseCommand(ViewSuccess);
            CompleteCommand   = new BaseCommand(ViewComplete);
            TotalCommand      = new BaseCommand(ViewTotal);

            LoadReport();
        }
Esempio n. 25
0
        public async Task GetAllProducts()
        {
            List <string> categories = await categoryService.GetCategories();

            var products = await ProductsService.GetProductsAsync();

            Products.Clear();

            var categorizedProducts = new List <CategorizedProducts>();

            GetOfferProducts(products).ToList().ForEach(p => OfferProducts.Add(p));

            categories.ForEach(cat => categorizedProducts.Add(new CategorizedProducts(GetCategorizedProducts(cat, products), cat)));

            Products.AddRange(categorizedProducts);
            ObservableRangeCollection <Product> offerProducts = new ObservableRangeCollection <Product>(products.Where(p => p.Offer != null));

            Products.Insert(0, new CategorizedProducts(offerProducts, "Tilbud"));
        }
Esempio n. 26
0
        private async Task ExecuteGetTransactionsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            GetTransactionsCommand.ChangeCanExecute();
            var showAlert = false;

            try
            {
                UpdateBalance();
                Transactions.Clear();

                var trans = await data.GetTransactionsAsync();

                foreach (var transaction in trans)
                {
                    Transactions.Add(new TransactionViewModel(page, transaction));
                }
                TransactionsFiltered = new ObservableRangeCollection <TransactionViewModel>(SortTransactionsByDate());
            }
            catch (WebException err)
            {
                await page.DisplayAlert("Ошибка", "У вас отсутствует подключение к интернету", "OK");
            }
            catch (Exception ex)
            {
                showAlert = true;
            }
            finally
            {
                IsBusy = false;
                GetTransactionsCommand.ChangeCanExecute();
            }

            if (showAlert)
            {
                await page.DisplayAlert("Упс ... :(", "Не получается получить мероприятия.", "OK");
            }
        }
Esempio n. 27
0
        public SendGroupingsPageViewModel()
        {
            _sendService          = ServiceContainer.Resolve <ISendService>("sendService");
            _syncService          = ServiceContainer.Resolve <ISyncService>("syncService");
            _stateService         = ServiceContainer.Resolve <IStateService>("stateService");
            _vaultTimeoutService  = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _deviceActionService  = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");

            Loading        = true;
            PageTitle      = AppResources.Send;
            GroupedSends   = new ObservableRangeCollection <ISendGroupingsPageListItem>();
            RefreshCommand = new Command(async() =>
            {
                Refreshing = true;
                await LoadAsync();
            });
            SendOptionsCommand = new Command <SendView>(SendOptionsAsync);
        }
Esempio n. 28
0
        /// <summary>
        /// 配对设备
        /// </summary>
        /// <returns></returns>
        public ObservableRangeCollection <Printer> PairedDevices()
        {
            var devices = new ObservableRangeCollection <Printer>();

            using (var bluetoothAdapter = BluetoothAdapter.DefaultAdapter)
            {
                if (bluetoothAdapter != null)
                {
                    //判断蓝牙是否开启
                    if (!bluetoothAdapter.IsEnabled)
                    {
                        bluetoothAdapter.Enable();
                    }

                    if (!bluetoothAdapter.IsDiscovering)
                    {
                        bluetoothAdapter.StartDiscovery();
                    }


                    var btdevices = bluetoothAdapter?.BondedDevices.ToList();
                    if (btdevices != null)
                    {
                        foreach (var bd in btdevices)
                        {
                            if (bd != null)
                            {
                                devices.Add(new Printer()
                                {
                                    LocalName = bd.Name,
                                    Address   = bd.Address,
                                    //"DC:1D:30:3A:37:A2"
                                    Status = App.BtAddress.Equals(bd.Address),
                                    Name   = bd.Name
                                });
                            }
                        }
                    }
                }
            }

            return(devices);
        }
Esempio n. 29
0
        //public MovieViewModel(INavigation navigation)
        //{
        //    _navigation = navigation;

        //    NavigateToDetail = new Command(async () => await NavigateToDetailAsync());

        //    Device.BeginInvokeOnMainThread(async () =>
        //    {
        //        IsBusy = true;

        //            await LoadNowPlayingMovies();
        //            await LoadPopularMovies();
        //            await LoadUpcomingMovies();
        //            await LoadFavoriteMovies();

        //            IsBusy = false;
        //    });
        //}

        private async Task LoadUpcomingMovies()
        {
            HttpClient client   = new HttpClient();
            var        uri      = new Uri($"http://api.themoviedb.org/3/movie/upcoming?api_key={apikey}&language={locale}");
            var        response = await client.GetAsync(uri);

            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();

                var json = JsonConvert.DeserializeObject <MovieResult>(content);

                UpcomingMovies = new ObservableRangeCollection <Movie>();
                foreach (var item in json.Results)
                {
                    UpcomingMovies.Add(item);
                }
            }
        }
        public void Grouping()
        {
            var sorted = from person in people
                         orderby person.FirstName
                         group person by person.Group
                         into personGroup
                         select new Grouping <string, Person>(personGroup.Key, personGroup);

            var grouped = new ObservableRangeCollection <Grouping <string, Person> >();

            grouped.AddRange(sorted);

            Assert.AreEqual(2, grouped.Count);
            Assert.AreEqual("J", grouped[0].Key);
            Assert.AreEqual(2, grouped[0].Count);
            Assert.AreEqual(1, grouped[1].Count);
            Assert.AreEqual(2, grouped[0].Items.Count);
            Assert.AreEqual(1, grouped[1].Items.Count);
        }
        public ChatqViewModel()
        {
            ListMessages = new ObservableRangeCollection <SignalrUser>();

            SendCommand = new Command(() =>
            {
                if (!String.IsNullOrWhiteSpace(OutText))
                {
                    var messageq = new SignalrUser
                    {
                        message         = OutText,
                        IsTextIn        = false,
                        MessageDateTime = DateTime.Now
                    };
                    ListMessages.Add(messageq);
                    OutText = "";
                }
            });
        }
Esempio n. 32
0
        public ChatBotViewModel()
        {
            Messages = new ObservableRangeCollection <ChatBotMessage>();

            SendCommand = new Command(() => {
                var message = new ChatBotMessage
                {
                    Message   = OutGoingText,
                    Incoming  = false,
                    TimeStamp = DateTime.Now
                };

                Messages.Add(message);

                OutGoingText = string.Empty;
            });

            InitializeMockData();
        }
Esempio n. 33
0
        public async Task <ObservableRangeCollection <Response> > GetDistressInterventions(string DistressLevelType)
        {
            /*
             * This function pulls the Second Half of the Support Plan from the Responses Table (Mild Moderate and Acute)
             */
            ObservableRangeCollection <Response> r = new ObservableRangeCollection <Response>();

            if (!DistressLevelType.Equals("Calm"))
            {
                //Pull every response with DistressLevelType override OR if the Question associated with the checked response has a QuestionCarePlanArea containing "Intervention"
                //Since Override takes priority over the actual Value of the stepper, the tuples that will be added that have the correct value will only be added if the Override is empty
                r.AddRange(await db.QueryAsync <Response>(
                               "SELECT *, RANDOM() As Random FROM [CheckBoxLabels] LEFT JOIN [Questions] WHERE (Questions.CPQID = CheckBoxLabels.CPQID AND CheckBoxLabels.Value = 1) AND (Questions.QuestionCarePlanArea LIKE '%Intervention%' OR CheckBoxLabels.Override = ?)"
                               + "UNION SELECT *, RANDOM() As Random FROM [StepperLabels] LEFT JOIN [Questions] WHERE (Questions.CPQID = StepperLabels.CPQID AND (StepperLabels.Value = ? AND StepperLabels.Override IS NULL)) AND (Questions.QuestionCarePlanArea LIKE '%Intervention%' OR StepperLabels.Override = ?)"
                               + "ORDER BY Random LIMIT 5"
                               , DistressLevelType, DistressType.DistressTypeValue(DistressLevelType), DistressLevelType));
            }
            return(r);
        }
Esempio n. 34
0
        async Task CargarContactos(int skipIndex, int takeIndex)
        {
            if (!NoHayNadaMasParaCargar)
            {
                ContactosDTO buscador = new ContactosDTO
                {
                    CodigoPersonaOwner      = App.Persona.Consecutivo,
                    SkipIndexBase           = skipIndex,
                    TakeIndexBase           = takeIndex,
                    IdiomaBase              = App.IdiomaPersona,
                    IdentificadorParaBuscar = TextoBuscador
                };

                if (IsNotConnected)
                {
                    return;
                }
                List <ContactosDTO> listaContactos = await _chatsServices.ListarContactos(buscador);

                if (listaContactos != null)
                {
                    if (listaContactos.Count > 0)
                    {
                        if (_contactos == null)
                        {
                            _contactos = new ObservableRangeCollection <ContactosDTO>(listaContactos);
                        }
                        else
                        {
                            listaContactos = listaContactos.Where(x => !_contactos.Where(y => y.Consecutivo == x.Consecutivo).Any()).ToList();
                            _contactos.AddRange(listaContactos);
                        }

                        RaisePropertyChanged("Contactos");
                    }
                    else
                    {
                        NoHayNadaMasParaCargar = listaContactos.Count <= 0;
                    }
                }
            }
        }
Esempio n. 35
0
        public SleepStatsViewModel()
        {
            LoginCommand      = new Command(Login);
            ViewChild         = Constants.DefaultChildId;
            UserInfo          = OfflineDefaultData.DefaultUserInfo;
            ProgenyCollection = new ObservableCollection <Progeny>();
            SleepItems        = new ObservableRangeCollection <Sleep>();
            SleepStats        = new SleepStatsModel();
            _lastDate         = _todayDate = DateTime.Now;
            _firstDate        = _startDate = DateTime.Now - TimeSpan.FromDays(30);
            _endDate          = DateTime.Now;
            _maxValue         = 24;
            _minValue         = 0;

            _chartTypeList = new List <string>();
            var ci = CrossMultilingual.Current.CurrentCultureInfo.TwoLetterISOLanguageName;

            if (ci == "da")
            {
                _chartTypeList.Add("Linjediagram");
                _chartTypeList.Add("Trappetrinsdiagram");
                _chartTypeList.Add("Stammediagram");
            }
            else
            {
                if (ci == "de")
                {
                    _chartTypeList.Add("Liniendiagramm");
                    _chartTypeList.Add("Treppenstufen-Diagramm");
                    _chartTypeList.Add("Stammdiagramm");
                }
                else
                {
                    _chartTypeList.Add("Line Chart");
                    _chartTypeList.Add("Stair Steps Chart");
                    _chartTypeList.Add("Stem Chart");
                }
            }


            SleepPlotModel = new PlotModel();
        }
        public void BindData()
        {
            GroupedItems = new ObservableRangeCollection <ArtSelectorGroup>();

            var artGroups = App.Database.GetArtGroups();
            var arter     = App.Database.GetArter();

            var arterInJakt = new ArtSelectorGroup("Mine favoritter", "");

            foreach (var art in arter.Where(j => j.Selected))
            {
                //art.Selected = CurrentLogg.ArtId == art.ID; //Remove selected for all but the picked art
                arterInJakt.Add(art);
            }
            if (arterInJakt.Count > 0)
            {
                GroupedItems.Add(arterInJakt);
            }

            foreach (var g in artGroups)
            {
                var arterInGroup = arter.Where(a => a.GroupId == g.ID);

                if (arterInGroup.Any())
                {
                    var ag = new ArtSelectorGroup(g.Navn, "");

                    foreach (var art in arterInGroup)
                    {
                        if (arterInJakt.All(a => a.ID != art.ID))
                        {
                            ag.Add(art);
                        }
                    }

                    if (ag.Count > 0)
                    {
                        GroupedItems.Add(ag);
                    }
                }
            }
        }
        public async Task InitializeAsync(string search = "")
        {
            try
            {
                UserDialogs.Instance.Loading("Estamos carregando os filmes, aguarde um instante..", null, null, true, MaskType.Gradient);

                var guid      = Guid.NewGuid().ToString();
                var publickey = GetHash(guid + AppSettings.PrivateKey + AppSettings.PublicKey);
                var endpoint  = $"characters?apikey={AppSettings.PublicKey}&hash={publickey}&ts={guid}&limit=10&offset=1";
                var response  = await dataService.GetAsync <Character>(endpoint, "character", 100);

                var list = (List <Models.Result>)response.Result;
                if (list.Count > 0 && list != null)
                {
                    Heroes.AddRange(list);
                    foreach (var item in list)
                    {
                        heroes.Add(item);
                    }
                }
                else
                {
                    Heroes = new ObservableRangeCollection <Result>(heroes.OrderBy(p => p.Name));
                    Heroes.AddRange(Heroes);
                    Message = "NENHUM PERSONAGEM FOI CARREGADO";
                }
                UserDialogs.Instance.ShowLoading("Finalizando..", MaskType.Gradient);
                UserDialogs.Instance.HideLoading();
            }
            catch (Exception exception)
            {
                UserDialogs.Instance.ShowLoading("Finalizando..", MaskType.Gradient);
                UserDialogs.Instance.HideLoading();
                var properties = new Dictionary <string, string> {
                    { "CharacterViewModel.cs", "InitializeAsync" }
                };
                //Crashes.TrackError(exception, properties);

                Heroes = new ObservableRangeCollection <Result>();
                Heroes.AddRange(Heroes);
            }
        }
Esempio n. 38
0
        public PaymentSettingsViewModel()
        {
            localSql = new PaymentMethodDataAccess();

            bool result = localSql.IsPaymentMethodTableExists();

            if (!result)
            {
                NotificationHelper.ShowMessage("PaymentMethod table not found", Utilities.GetResourceValue("CaptionError"));
                return;
            }

            Responses         = new ObservableRangeCollection <PaymentSettingsModel>();
            ComboBoxGpPayment = AddGpPayments();
            LoadGrid();
            ClosePopupCommand    = new BaseCommand(ClosePopup);
            AddNewPaymentCommand = new BaseCommand(AddNewPaymentRecord);
            SavePaymentCommand   = new BaseCommand(SavePaymentRecord);
            ViewRecordCommand    = new BaseCommand(ViewRecord);
        }
        public AutoCompleteBoxView()
        {
            InitializeComponent();

            tree = new TernaryTree();
            Suggestions = new ObservableRangeCollection<object>();

            autoCompleteTextBox.DataContext = this;

            Binding textBinding = new System.Windows.Data.Binding("Text");
            textBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            textBinding.Mode = BindingMode.TwoWay;

            autoCompleteTextBox.SetBinding(TextBox.TextProperty, textBinding);

            popupItemsControl.DataContext = this;
            popupItemsControl.SetBinding(ItemsControl.ItemsSourceProperty, new System.Windows.Data.Binding("Suggestions"));

            mouseOverPopup = false;
        }
        public DashboardViewModel(ScreenTypeEnum type, Plan plan)
        {
            ScreenPlan = plan;
            ScreenType = type;
            Title      = plan != null ? plan.Name : AppResources.title_dashboard;
            Devices    = new ObservableRangeCollection <Models.Device>();

            LoadFavoriteCommand    = new Command(async() => await ExecuteLoadFavoritesCommand(false));
            RefreshFavoriteCommand = new Command(async() => await ExecuteLoadFavoritesCommand(true));
            RefreshActionCommand   = new Command(async() => await ExecuteLoadFavoritesCommand(false));

            if (!LoadCache)
            {
                return;
            }
            OldData = true;
            Devices = Cache.GetCache <ObservableRangeCollection <Models.Device> >(ScreenPlan != null ? ScreenPlan.idx + ScreenType : ScreenType.ToString()) ??
                      new ObservableRangeCollection <Models.Device>();
            LoadCache = false;
        }
Esempio n. 41
0
        public ItemsViewModel()
        {
            Title            = "Browse";
            Items            = new ObservableRangeCollection <Item>();
            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());

            MessagingCenter.Subscribe <NewItemPage, Item>(this, "AddItem", async(obj, item) =>
            {
                var _item = item as Item;
                Items.Add(_item);
                await DataStore.AddItemAsync(_item);
            });

            MessagingCenter.Subscribe <ItemDetailPage, Item>(this, "UpdateItem", async(obj, item) =>
            {
                var _item = item as Item;
                // Items.Add(_item);
                await DataStore.UpdateItemAsync(_item);
            });
        }
Esempio n. 42
0
        private List <IOrder> InitOrders()
        {
            if (TryLoadFromStorage == false)
            {
                try
                {
                    m_oOrders = LoadOrders();
                    m_oOrders.CollectionChanged -= M_oOrders_CollectionChanged;
                    m_oOrders.CollectionChanged += M_oOrders_CollectionChanged;
                }
                catch (Exception ex)
                {
                    ImperaturGlobal.GetLog().Error("Loading orders went wrong", ex);
                    m_oOrders = new ObservableRangeCollection <IOrder>();
                }
            }
            TryLoadFromStorage = true;

            return(new List <IOrder>((IEnumerable <IOrder>)m_oOrders));
        }
Esempio n. 43
0
        public MasterViewModel()
        {
            Title        = "Tokyo-Hot";
            actorService = new ActorService();
            details      = new ObservableRangeCollection <DetailViewModel> ();
            LoadData();

            ItemTappedCommand = new Command((obj) => {
                var actor = obj as Actor;
                Debug.WriteLine("{0} was tapped.", actor.Name);

                var detailViewModel = Details
                                      .Where(d => d.Actor.ID == actor.ID)
                                      .Select(d => d)
                                      .Single();
                var mainPage  = App.Current.MainPage;
                var navgation = mainPage.Navigation;
                navgation.PushAsync(new Views.DetailPage(detailViewModel));
            });
        }
        public void RemoveRange_WhenCalledWithValidRangeAndResetMode_RemovesItemsAndNotifies(
            ObservableRangeCollection <int> collection, IEnumerable <int> removeItems)
        {
            var raisedEvent = Assert.Raises <NotifyCollectionChangedEventArgs>(
                handler => collection.CollectionChanged += (s, e) => handler.Invoke(s, e),
                handler => { },
                () => collection.RemoveRange(removeItems, NotifyCollectionChangedAction.Reset));

            var items = new List <int>(collection);

            foreach (var item in removeItems)
            {
                items.Remove(item);
            }

            Assert.NotNull(raisedEvent);
            Assert.Equal(NotifyCollectionChangedAction.Reset, raisedEvent.Arguments.Action);
            Assert.Equal(-1, raisedEvent.Arguments.OldStartingIndex);
            Assert.Equal(items, collection);
        }
        public void InsertRangeSorted_WhenCalledWithValidRangeAndValidComparisonAndResetNotificationMode_InsertsItemsCorrectlyAndNotifies(
            ObservableRangeCollection <int> collection,
            IEnumerable <int> insertItems,
            Comparison <int> comparison)
        {
            collection.Sort(comparison);
            var items = new List <int>(collection);

            items.AddRange(insertItems);
            items.Sort(comparison);

            var raisedEvent = Assert.RaisesAny <NotifyCollectionChangedEventArgs>(
                handler => collection.CollectionChanged += (s, e) => handler.Invoke(s, e),
                handler => { },
                () => collection.InsertRangeSorted(insertItems, comparison, NotifyCollectionChangedAction.Reset));

            Assert.NotNull(raisedEvent);
            Assert.Equal(NotifyCollectionChangedAction.Reset, raisedEvent.Arguments.Action);
            Assert.Equal(items, collection);
        }
        public void GetFramesListTest()
        {
            Frame f1 = MockRepository.GenerateMock <Frame>("");
            Frame f2 = MockRepository.GenerateMock <Frame>("");
            Frame f3 = MockRepository.GenerateMock <Frame>("");

            testFramesContainer.AddFrame(f1);
            testFramesContainer.AddFrame(f2);
            testFramesContainer.AddFrame(f3);

            ObservableRangeCollection <Frame> fl = new ObservableRangeCollection <Frame>();

            fl.Add(f1);
            fl.Add(f2);
            fl.Add(f3);

            Assert.AreEqual(testFramesContainer.FramesList.ElementAt(0), fl.ElementAt(0));
            Assert.AreEqual(testFramesContainer.FramesList.ElementAt(1), fl.ElementAt(1));
            Assert.AreEqual(testFramesContainer.FramesList.ElementAt(2), fl.ElementAt(2));
        }
Esempio n. 47
0
        public MainPageViewModel()
        {
            ListMessages = new ObservableRangeCollection <Message>();

            SendCommand = new Command(() =>
            {
                if (!String.IsNullOrWhiteSpace(OutText))
                {
                    var message = new Message
                    {
                        Text            = OutText,
                        IsTextIn        = false,
                        MessageDateTime = DateTime.Now,
                    };

                    ListMessages.Add(message);
                    OutText = "";
                }
            });
        }
Esempio n. 48
0
        public ListPageViewModel(
            INavigationService navigationService,
            ISillyDudeService sillyDudeService,
            ErrorEmulator errorEmulator)
            : base(navigationService)
        {
            _sillyDudeService = sillyDudeService;
            InitCommands();

            ErrorEmulator = new ErrorEmulatorVm(errorEmulator, Load);

            SillyPeople          = new ObservableRangeCollection <SillyDudeVmo>();
            SillyPeoplePaginator = new Paginator <SillyDude>(
                LoadSillyPeoplePageAsync,
                pageSize: PageSize,
                loadingThreshold: 0.1f);
            SillyPeopleLoader = new ViewModelLoader <IReadOnlyCollection <SillyDude> >(
                ApplicationExceptions.ToString,
                SillyResources.Empty_Screen);
        }
        public void AddRange_WhenCalledWithValidRangeAndAddMode_AddsItemsAndNotifies(
            ObservableRangeCollection <int> collection,
            IEnumerable <int> addItems)
        {
            var initialCount = collection.Count;

            var raisedEvent = Assert.Raises <NotifyCollectionChangedEventArgs>(
                handler => collection.CollectionChanged += (s, e) => handler.Invoke(s, e),
                handler => { },
                () => collection.AddRange(addItems, NotifyCollectionChangedAction.Add));

            Assert.NotNull(raisedEvent);
            Assert.Equal(NotifyCollectionChangedAction.Add, raisedEvent.Arguments.Action);
            Assert.Null(raisedEvent.Arguments.OldItems);
            Assert.Equal(initialCount, raisedEvent.Arguments.NewStartingIndex);

            var newItems = raisedEvent.Arguments.NewItems.Cast <int>().ToList();

            Assert.Equal(addItems, newItems);
        }
Esempio n. 50
0
		public MainViewModel()
		{
			StartMonitoringCommand = new RelayCommand(OnStartMonitoring);
			StopMonitoringCommand = new RelayCommand(OnStopMonitoring);
			SuspendMonitoringCommand = new RelayCommand(OnSuspendMonitoring);
			ResumeMonitoringCommand = new RelayCommand(OnResumeMonitoring);
			TestComPortCommand = new RelayCommand(OnTestComPort);
			SetNewConfigurationCommand = new RelayCommand(OnSetNewConfiguration);
			GetSerialListCommand = new RelayCommand(OnGetSerialList);
			SetInitializingTestCommand = new RelayCommand(OnSetInitializingTest);
			ReadConfigurationCommand = new RelayCommand(OnReadConfiguration);

			DevicesViewModel = new DevicesViewModel();
			ZonesViewModel = new ZonesViewModel();
			JournalItems = new ObservableCollection<FS2JournalItem>();

			CallbackManager.NewJournalItem += new Action<FS2JournalItem>(ShowNewItem);
			ProgressInfos = new ObservableRangeCollection<FS2ProgressInfo>();
			Logs = new ObservableCollection<string>();
			CallbackManager.ProgressEvent += new System.Action<FS2ProgressInfo>(CallbackManager_ProgressEvent);
			CallbackManager.LogEvent += new System.Action<string>(CallbackManager_LogEvent);
		}
Esempio n. 51
0
		public MainViewModel()
		{
			Current = this;
			CancelProgressCommand = new RelayCommand(OnCancelProgress);
			SendRequestCommand = new RelayCommand(OnSendRequest);
			AutoDetectDeviceCommand = new RelayCommand(OnAutoDetectDevice, CanAutoDetectDevice);
			ReadConfigurationCommand = new RelayCommand(OnReadConfiguration, CanReadConfiguration);
			ReadJournalCommand = new RelayCommand(OnReadJournal, CanReadJournal);
			GetInformationCommand = new RelayCommand(OnGetInformation, CanGetInformation);
			SynchronizeTimeCommand = new RelayCommand(OnSynchronizeTime, CanSynchronizeTime);
			SetPasswordCommand = new RelayCommand(OnSetPassword, CanSetPassword);
			RunOtherFunctionsCommand = new RelayCommand(OnRunOtherFunctions, CanRunOtherFunctions);
			UpdateFirmwhareCommand = new RelayCommand(OnUpdateFirmwhare, CanUpdateFirmwhare);
			WriteConfigurationCommand = new RelayCommand(OnWriteConfiguration, CanWriteConfiguration);
			GetDeviceStatusCommand = new RelayCommand(OnGetDeviceStatus, CanGetResetDeviceStatus);
			TestCommand = new RelayCommand(OnTest);
			MergeJournalCommand = new RelayCommand(OnMergeJournal, CanMergeJournal);
			DevicesViewModel = new DevicesViewModel();
			ZonesViewModel = new ZonesViewModel();
			ZonesViewModel.Initialize();
			ProgressInfos = new ObservableRangeCollection<FS2ProgressInfo>();
			CallbackManager.ProgressEvent += new System.Action<FS2Api.FS2ProgressInfo>(CallbackManager_ProgressEvent);
		}
Esempio n. 52
0
		public ProcedureViewModel(Procedure procedure)
		{
			ShowStepsCommand = new RelayCommand(OnShowSteps);
			ShowVariablesCommand = new RelayCommand(OnShowVariables);
			ShowArgumentsCommand = new RelayCommand(OnShowArguments);
			ShowConditionsCommand = new RelayCommand(OnShowConditions);

			Procedure = procedure;
			procedure.PlanElementUIDsChanged += UpdateVisualizationState;
			StepsViewModel = new StepsViewModel(procedure);
			VariablesViewModel = new VariablesViewModel(procedure);
			ArgumentsViewModel = new ArgumentsViewModel(procedure);
			ConditionsViewModel = new ConditionsViewModel(procedure);

			MenuTypes = new ObservableRangeCollection<MenuType>
			{
				MenuType.IsSteps,
				MenuType.IsVariables,
				MenuType.IsArguments,
				MenuType.IsConditions
			};
			SelectedMenuType = MenuTypes.FirstOrDefault();
		}
        public ObservableRangeCollection<GroupInfoList<object>> SetGroupsByLetter()
        {
            if (_groupsByLetter == null)
            {

                _groupsByLetter = new ObservableRangeCollection<GroupInfoList<object>>();
                var query = from item in Collection
                    orderby ((Entry) item).Name
                    group item by ((Entry) item).Name.ToUpper()[0]
                    into g
                    select new {GroupName = (IsNotLetter(g.Key) ? '#' : g.Key), Items = g};
                foreach (var g in query)
                {
                    GroupInfoList<object> info = new GroupInfoList<object>();
                    info.Key = g.GroupName;
                    foreach (Entry entry in g.Items)
                    {
                        info.Add(entry);
                    }
                    AddOrUpdateExistent(_groupsByLetter, info);
                }
            }
            return _groupsByLetter;
        }
Esempio n. 54
0
        public static void SortListByTap(string property)
        {
            var artIntermediateList = CurrentData.ArtPropList(property);

            if (property == "Income")
                artIncomeList = new ObservableRangeCollection<ArticleProperty>(artIntermediateList.OrderBy(artlist => artlist.TapNumber * (-1)));
            else if (property == "Outlay")
                artOutlayList = new ObservableRangeCollection<ArticleProperty>(artIntermediateList.OrderBy(artlist => artlist.TapNumber * (-1)));
            else if (property == "Account")
                ArtAccountList.AccountsList = new ObservableRangeCollection<ArticleProperty>(artIntermediateList.OrderBy(artlist => artlist.TapNumber * (-1)));
        }
 public EntryRepository()
 {
     Collection = new ObservableRangeCollection<Entry>();
 }
 public void UpdateRepository()
 {
     _groupsByLetter = null;
     _passwordHeaders = null;
     SetGroupsByLetter();
 }
 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. 58
0
 public Project()
 {
     Programs = new ObservableRangeCollection<Program>();
     MetadataFiles = new ObservableRangeCollection<MetadataFile>();
 }
Esempio n. 59
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. 60
0
        public static ObservableRangeCollection<ArticleProperty> ArtPropList(string prop)
        {
            ObservableRangeCollection<ArticleProperty> returnList;

            if (prop == "Income")
                returnList = artIncomeList;
            else if (prop == "Outlay")
                returnList = artOutlayList;
            else if (prop == "Account")
                returnList = ArtAccountList.AccountsList;
            else returnList = new ObservableRangeCollection<ArticleProperty>();

            if (returnList != null)
                return returnList;
            else
                return returnList = ArticleOperations.ArticlePropertyListDeserialize(prop);
        }