Example #1
0
        public void TestMethod1()
        {
            SortableObservableCollection <int> list1 = new SortableObservableCollection <int>();
            var list2  = new SortableObservableCollection <int>();
            var random = new Random();
            var ready  = false;
            var thread = new Thread(() =>
            {
                for (int i = 0; i < 100000; i++)
                {
                    list2.Insert(0, random.Next());
                    while (list2.Count > 100)
                    {
                        list2.RemoveAt(list2.Count - 1);
                    }
                }
                ready = true;
            });

            thread.Start();
            for (int i = 0; i < 1000000; i++)
            {
                list1.Sync(list2);
            }
            while (!ready)
            {
                Thread.Sleep(1);
            }
            Assert.AreEqual(list1.Count, list2.Count);
            for (int i = 0; i < list1.Count; i++)
            {
                Assert.AreEqual(list1[i], list2[i]);
            }
        }
		public PumpStationsSelectationViewModel(List<GKPumpStation> pumpStations)
		{
			Title = "Выбор насосных станций";
			AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
			RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
			AddAllCommand = new RelayCommand(OnAddAll, CanAddAll);
			RemoveAllCommand = new RelayCommand(OnRemoveAll, CanRemoveAll);
			CreateNewCommand = new RelayCommand(OnCreateNew);

			PumpStations = pumpStations;
			TargetPumpStations = new SortableObservableCollection<GKPumpStation>();
			SourcePumpStations = new SortableObservableCollection<GKPumpStation>();

			foreach (var pumpStation in GKManager.PumpStations)
			{
				if (PumpStations.Contains(pumpStation))
					TargetPumpStations.Add(pumpStation);
				else
					SourcePumpStations.Add(pumpStation);
			}
			TargetPumpStations.Sort(x => x.No);
			SourcePumpStations.Sort(x => x.No);

			SelectedTargetPumpStation = TargetPumpStations.FirstOrDefault();
			SelectedSourcePumpStation = SourcePumpStations.FirstOrDefault();
		}
		public ZonesSelectationViewModel(List<GKZone> zones, bool canCreateNew = false)
		{
			Title = "Выбор зон";
			AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
			RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
			AddAllCommand = new RelayCommand(OnAddAll, CanAddAll);
			RemoveAllCommand = new RelayCommand(OnRemoveAll, CanRemoveAll);
			CreateNewCommand = new RelayCommand(OnCreateNew);

			Zones = zones;
			CanCreateNew = canCreateNew;
			TargetZones = new SortableObservableCollection<GKZone>();
			SourceZones = new SortableObservableCollection<GKZone>();

			foreach (var zone in GKManager.DeviceConfiguration.SortedZones)
			{
				if (Zones.Contains(zone))
					TargetZones.Add(zone);
				else
					SourceZones.Add(zone);
			}
			TargetZones.Sort(x => x.No);
			SourceZones.Sort(x => x.No);

			SelectedTargetZone = TargetZones.FirstOrDefault();
			SelectedSourceZone = SourceZones.FirstOrDefault();
		}
Example #4
0
        public void EightTournamentsInCategory()
        {
            TestGroupVw soccerCategory = new TestGroupVw()
            {
                DisplayName = "soccer category", LineObject = new GroupLn()
                {
                    GroupId = 1, Sort = new ObservableProperty <int>(new GroupLn(), new ObservablePropertyList(), "test")
                    {
                        Value = 1
                    }
                }
            };
            SortableObservableCollection <IMatchVw> collection = new SortableObservableCollection <IMatchVw>();

            collection = FillCategoryWithTournaments(soccerCategory, 8);

            ChangeTracker.Setup(x => x.SelectedTournaments).Returns(new HashSet <string>());
            TranslationProvider.Setup(x => x.Translate(It.IsAny <MultistringTag>())).Returns("Outrights");
            Repository.Setup(x => x.FindMatches(It.IsAny <SortableObservableCollection <IMatchVw> >(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <LineSr.DelegateFilterMatches>(), It.IsAny <Comparison <IMatchVw> >())).Returns(collection);

            TopTournamentsViewModel model = new TopTournamentsViewModel();

            model.OnNavigationCompleted();

            //no outrights, without "all tournaments"
            Assert.AreEqual(1, model.Categories.Count);
            Assert.AreEqual("soccer category", model.Categories[0].SportName);
            Assert.AreEqual(8, model.Categories[0].Tournaments.Count);
            Assert.AreEqual("tournament0", model.Categories[0].Tournaments[0].Name);
            Assert.AreEqual("tournament7", model.Categories[0].Tournaments[7].Name);
        }
		public DirectionsSelectationViewModel(List<GKDirection> directions)
		{
			Title = "Выбор направлений";
			AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
			RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
			AddAllCommand = new RelayCommand(OnAddAll, CanAddAll);
			RemoveAllCommand = new RelayCommand(OnRemoveAll, CanRemoveAll);
			CreateNewCommand = new RelayCommand(OnCreateNew);

			Directions = directions;
			TargetDirections = new SortableObservableCollection<GKDirection>();
			SourceDirections = new SortableObservableCollection<GKDirection>();

			foreach (var direction in GKManager.Directions)
			{
				if (Directions.Contains(direction))
					TargetDirections.Add(direction);
				else
					SourceDirections.Add(direction);
			}
			TargetDirections.Sort(x => x.No);
			SourceDirections.Sort(x => x.No);

			SelectedTargetDirection = TargetDirections.FirstOrDefault();
			SelectedSourceDirection = SourceDirections.FirstOrDefault();
		}
Example #6
0
		public TimeTrackingViewModel()
		{
			ShowFilterCommand = new RelayCommand(OnShowFilter, CanShowFilter);
			RefreshCommand = new RelayCommand(OnRefresh, CanRefresh);
			PrintCommand = new RelayCommand(OnPrint, CanPrint);
			ShowDocumentTypesCommand = new RelayCommand(OnShowDocumentTypes, CanShowDocumentTypes);
			ShowNightSettingsCommand = new RelayCommand(OnShowNightSettingsCommand, CanShowNightSettings);
			ServiceFactory.Events.GetEvent<EditDocumentEvent>().Unsubscribe(OnEditDocument);
			ServiceFactory.Events.GetEvent<EditDocumentEvent>().Subscribe(OnEditDocument);
			ServiceFactory.Events.GetEvent<RemoveDocumentEvent>().Unsubscribe(OnRemoveDocument);
			ServiceFactory.Events.GetEvent<RemoveDocumentEvent>().Subscribe(OnRemoveDocument);
			ServiceFactory.Events.GetEvent<EditTimeTrackPartEvent>().Unsubscribe(OnEditTimeTrackPart);
			ServiceFactory.Events.GetEvent<EditTimeTrackPartEvent>().Subscribe(OnEditTimeTrackPart);
			ServiceFactory.Events.GetEvent<ChiefChangedEvent>().Unsubscribe(OnInitializeLeadUIDs);
			ServiceFactory.Events.GetEvent<ChiefChangedEvent>().Subscribe(OnInitializeLeadUIDs);

			TimeTrackFilter = new TimeTrackFilter();
			TimeTrackFilter.EmployeeFilter = new EmployeeFilter()
			{
				User = ClientManager.CurrentUser, 
			};

			TimeTrackFilter.Period = TimeTrackingPeriod.CurrentMonth;
			TimeTrackFilter.StartDate = DateTime.Today.AddDays(1 - DateTime.Today.Day);
			TimeTrackFilter.EndDate = DateTime.Today;

			TimeTracks = new SortableObservableCollection<TimeTrackViewModel>();
		}
		public MPTsSelectationViewModel(List<GKMPT> mpts, bool canCreateNew = false)
		{
			Title = "Выбор МПТ";
			AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
			RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
			AddAllCommand = new RelayCommand(OnAddAll, CanAddAll);
			RemoveAllCommand = new RelayCommand(OnRemoveAll, CanRemoveAll);
			CreateNewCommand = new RelayCommand(OnCreateNew);

			MPTs = mpts;
			CanCreateNew = canCreateNew;
			TargetMPTs = new SortableObservableCollection<GKMPT>();
			SourceMPTs = new SortableObservableCollection<GKMPT>();

			foreach (var mpt in GKManager.DeviceConfiguration.MPTs)
			{
				if (MPTs.Contains(mpt))
					TargetMPTs.Add(mpt);
				else
					SourceMPTs.Add(mpt);
			}
			TargetMPTs.Sort(x => x.No);
			SourceMPTs.Sort(x => x.No);

			SelectedTargetMPT = TargetMPTs.FirstOrDefault();
			SelectedSourceMPT = SourceMPTs.FirstOrDefault();
		}
Example #8
0
        private void ConvertMatchesToButtons(SortableObservableCollection <IMatchVw> matches, SortableObservableCollection <VFLMatchButton> vflMatchButtons)
        {
            SortableObservableCollection <VFLMatchButton> buttons = new SortableObservableCollection <VFLMatchButton>();
            int channel = 0;

            foreach (MatchVw match in matches.OrderBy(x => x.LineObject.BtrMatchId))
            {
                VFLMatchButton button = new VFLMatchButton(match.HomeCompetitorName, match.AwayCompetitorName, match.LineObject.BtrMatchId, match);
                button.Channel = channel++;
                buttons.Add(button);
            }

            if (vflMatchButtons.Count != 0)
            {
                if (buttons.Count == 0)
                {
                    vflMatchButtons.Clear();
                }

                if (vflMatchButtons[0].MatchVw.VirtualDay != buttons[0].MatchVw.VirtualDay)
                {
                    vflMatchButtons.Clear();
                }
            }
            if (vflMatchButtons.Count == 0)
            {
                foreach (var vflMatchButton in buttons)
                {
                    vflMatchButtons.Add(vflMatchButton);
                }
                vflMatchButtons.ElementAt(0).IsSelected = true;
                OnOpenVflPage(vflMatchButtons.ElementAt(0));
            }
        }
        public void SortTest()
        {
            SortableObservableCollection <TournamentVw> Tournaments = new SortableObservableCollection <TournamentVw>();

            Tournaments.Add(new TournamentVw(1, 1, "AMyTournament", 0, 0, null, ""));
            Tournaments.Add(new TournamentVw(3, 1, "CMyTournament", 0, 0, null, ""));
            Tournaments.Add(new TournamentVw(4, 1, "AMyTournament", 0, 0, null, ""));
            Tournaments.Add(new TournamentVw(2, 1, "AMyTournament", 0, 0, null, ""));
            Tournaments.Add(new TournamentVw(5, 1, "DMyTournament", 0, 0, null, ""));
            Tournaments.Add(new TournamentVw(6, 1, "GMyTournament", 0, 0, null, ""));
            Tournaments.Add(new TournamentVw(8, 1, "ZMyTournament", 0, 0, null, ""));
            Tournaments.Add(new TournamentVw(7, 1, "KMyTournament", 0, 0, null, ""));
            Tournaments.Add(new TournamentVw(10, 1, "LMyTournament", 0, 0, null, ""));
            Tournaments.Add(new TournamentVw(9, 1, "AMyTournament", 0, 0, null, ""));

            Tournaments.Sort(TournamentsViewModel.Comparison);

            Assert.AreEqual(1, Tournaments[0].Id);
            Assert.AreEqual(2, Tournaments[1].Id);
            Assert.AreEqual(4, Tournaments[2].Id);
            Assert.AreEqual(9, Tournaments[3].Id);
            Assert.AreEqual(3, Tournaments[4].Id);
            Assert.AreEqual(5, Tournaments[5].Id);
            Assert.AreEqual(6, Tournaments[6].Id);
            Assert.AreEqual(7, Tournaments[7].Id);
            Assert.AreEqual(10, Tournaments[8].Id);
            Assert.AreEqual(8, Tournaments[9].Id);
        }
        public static void UpdateHeaders <T>(SortableObservableCollection <T> MatchesCollection) where T : IMatchVw
        {
            string oldSport     = "";
            bool   isPreLiveOld = false;

            for (int i = 0; i < MatchesCollection.Count; i++)
            {
                string currentSport = MatchesCollection[i].SportDescriptor;
                var    isPreLive    = MatchesCollection[i].LiveBetStatus == eMatchStatus.NotStarted || !MatchesCollection[i].IsLiveBet;
                if (string.IsNullOrEmpty(currentSport))
                {
                    continue;
                }

                if (currentSport != oldSport)
                {
                    MatchesCollection[i].IsHeaderForLiveMonitor = true;
                }
                else if (isPreLive && !isPreLiveOld)
                {
                    MatchesCollection[i].IsHeaderForLiveMonitor = true;
                }
                else
                {
                    MatchesCollection[i].IsHeaderForLiveMonitor = false;
                }
                oldSport     = currentSport;
                isPreLiveOld = isPreLive;
            }
        }
        /// <summary>
        /// Loads the values of the combobox cbxSelectedMultiSite and selects the predefined value, if was set
        /// </summary>
        private void LoadMultiSiteComboBox()
        {
            var tmp = new List <string>();

            tmp.Add(ApplicationSettings.AutomaticSite);

            var multiSiteList = _sites.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var entry in multiSiteList)
            {
                var site = entry.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                tmp.Add(site[0]);
            }

            AvailableSites = new SortableObservableCollection <string>(tmp);
            AvailableSites.Sort(x => x.ToString(), ListSortDirection.Ascending);

            if ((ApplicationSettings.Instance.SelectedMultiSiteEntry != null) && (AvailableSites.Contains(ApplicationSettings.Instance.SelectedMultiSiteEntry)))
            {
                SelectedSite = ApplicationSettings.Instance.SelectedMultiSiteEntry;
            }
            else
            {
                SelectedSite = ApplicationSettings.AutomaticSite;
            }
        }
Example #12
0
 public SummaryViewModel(INavigator navigator, IQueryDispatcher queryDispatcher)
     : base(navigator)
 {
     Ensure.NotNull(queryDispatcher, "queryDispatcher");
     this.queryDispatcher = queryDispatcher;
     Items = new SortableObservableCollection<ISummaryItemViewModel>();
 }
Example #13
0
        private void OnTournamentChoiceExecute(TournamentVw tournament)
        {
            if (tournament.IsOutrightGroup)
            {
                var tournamentsData = new TournamentsViewModel(SelectedCategoryId, tournament);
                tournamentsData.OnNavigationCompleted();

                var outrightsMatches = new SortableObservableCollection <IMatchVw>();
                var tournaments      = new SortableObservableCollection <TournamentVw>(tournamentsData.Tournaments);
                foreach (var tornmt in tournaments)
                {
                    var matchData = new MatchesViewModel(new HashSet <string>()
                    {
                        tornmt.ContainsOutrights?tornmt.Id.ToString() + "*1" : tornmt.Id.ToString() + "*0"
                    });
                    matchData.SelectedDescriptors.Add(SelectedSportDescriptor);
                    matchData.OnNavigationCompleted();
                    outrightsMatches.AddRange(matchData.Matches);
                }

                TournamentMatches = outrightsMatches;
            }
            else
            {
                var matchesData = new MatchesViewModel(new HashSet <string>()
                {
                    tournament.ContainsOutrights?tournament.Id.ToString() + "*1" : tournament.Id.ToString() + "*0"
                });
                matchesData.SelectedDescriptors.Add(SelectedSportDescriptor);
                matchesData.OnNavigationCompleted();
                TournamentMatches = matchesData.Matches;
            }
        }
		void UpdateDevices()
		{
			AvailableDevices = new SortableObservableCollection<GKDevice>();
			Devices = new SortableObservableCollection<GKDevice>();
			SelectedAvailableDevice = null;
			SelectedDevice = null;

			foreach (var device in SourceDevices)
			{
				if (!device.Driver.IsGroupDevice)
				{
					if (DevicesList.Contains(device))
						Devices.Add(device);
					else
						AvailableDevices.Add(device);
				}
			}
			Devices.Sort(x => x.IntDottedPresentationAddress);
			AvailableDevices.Sort(x => x.IntDottedPresentationAddress);

			SelectedDevice = Devices.FirstOrDefault();
			SelectedAvailableDevice = AvailableDevices.FirstOrDefault();

			OnPropertyChanged(() => Devices);
			OnPropertyChanged(() => AvailableDevices);
		}
Example #15
0
        private void OnChoiceExecute(long id)
        {
            TournamentVw.CheckFlag = true;
            TournamentVw._instances.Clear();
            if (TournamentMatches != null && TournamentMatches.Count > 0)
            {
                TournamentMatches = null;
            }
            if (SelectedTournaments != null && SelectedTournaments.Count > 0)
            {
                SelectedTournaments.Clear();
            }
            var category = Categories.Where(c => c.Id == id).FirstOrDefault();

            SelectedSportDescriptor = category.SportDescriptor;
            ButtonBackground        = category.BackgroundBySport;
            var tournamentsData = new TournamentsViewModel(id);

            tournamentsData.OnNavigationCompleted();
            Tournaments              = new SortableObservableCollection <TournamentVw>(tournamentsData.Tournaments);
            ShowCountries            = new SortableObservableCollection <TournamentVw>(Tournaments.GroupBy(p => p.Country).Select(g => g.First()).ToList());
            ShowCountries[0].Country = "Outrights";
            SelectedCategoryId       = id;
            TournamentVw.CheckFlag   = false;
        }
		public ScheduleZoneDetailsViewModel(Schedule schedule, Organisation organisation)
		{
			Title = "Добавить новые зоны";
			ScheduleZone = new List<ScheduleZone>();

			Zones = new SortableObservableCollection<SelectationScheduleZoneViewModel>();
			var organisationResult = OrganisationHelper.GetSingle(organisation.UID);
			_doorUIDs = organisationResult != null ? organisationResult.DoorUIDs : new List<Guid>();

			var gkDoors = GKManager.Doors.Where(x => _doorUIDs.Any(y => y == x.UID));
			foreach (var door in gkDoors)
			{
				if (door.EnterZoneUID != Guid.Empty)
				{
					var enterZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.EnterZoneUID);
					if (enterZone != null && !Zones.Any(x => x.ZoneUID == enterZone.UID))
						Zones.Add(new SelectationScheduleZoneViewModel(enterZone, schedule, door.UID));
				}

				if (door.ExitZoneUID != Guid.Empty)
				{
					var exitZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.ExitZoneUID);
					if (exitZone != null && !Zones.Any(x => x.ZoneUID == exitZone.UID))
						Zones.Add(new SelectationScheduleZoneViewModel(exitZone, schedule, door.UID));
				}
			}

			Zones = new ObservableCollection<SelectationScheduleZoneViewModel>(Zones.OrderBy(x => x.No)); //TODO: 
			SelectedZone = Zones.FirstOrDefault();
		}
Example #17
0
        public static void UpdateHeaders <T>(SortableObservableCollection <T> matchesCollection) where T : IMatchVw
        {
            string oldSport     = "";
            bool   isPreLiveOld = false;

            if (matchesCollection == null)
            {
                return;
            }
            foreach (T match in matchesCollection)
            {
                string currentSport = match.SportDescriptor;
                var    isPreLive    = match.LiveBetStatus == eMatchStatus.NotStarted || !match.IsLiveBet;
                if (string.IsNullOrEmpty(currentSport))
                {
                    continue;
                }

                if (currentSport != oldSport)
                {
                    match.IsHeader = true;
                }
                else if (isPreLive && !isPreLiveOld)
                {
                    match.IsHeader = true;
                }
                else
                {
                    match.IsHeader = false;
                }
                oldSport     = currentSport;
                isPreLiveOld = isPreLive;
            }
        }
Example #18
0
        // Поиск потомков узла дерева сыслающегося на строку с ключом node_id
        private SortableObservableCollection <INode> GetChildren(int node_id, IEnumerable <Collect> list)
        {
            SortableObservableCollection <INode> tree = new SortableObservableCollection <INode>();

            foreach (Collect t in list.Where(n => n.Parent_id == node_id))
            {
                if (t.Type == "sheet") // конечный узел дерева - "лист"
                {
                    CSheet sheet = new CSheet();
                    sheet.Id       = t.Id;
                    sheet.ParentId = t.Parent_id;
                    sheet.Name     = t.Collect_name;
                    sheet.Dat      = t.DDate;
                    tree.Add(sheet);
                }
                else
                {
                    CNode node = new CNode();
                    node.Id       = t.Id;
                    node.Name     = t.Collect_name;
                    node.Children = GetChildren(t.Id, list);
                    tree.Add(node);
                }
            }
            tree.Sort(t => t.Name);
            return(tree);
        }
		public DelaysSelectationViewModel(List<GKDelay> delays)
		{
			Title = "Выбор задержек";
			AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
			RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
			AddAllCommand = new RelayCommand(OnAddAll, CanAddAll);
			RemoveAllCommand = new RelayCommand(OnRemoveAll, CanRemoveAll);
			CreateNewCommand = new RelayCommand(OnCreateNew);

			Delays = delays;
			TargetDelays = new SortableObservableCollection<GKDelay>();
			SourceDelays = new SortableObservableCollection<GKDelay>();

			foreach (var delay in GKManager.DeviceConfiguration.Delays)
			{
				if (Delays.Contains(delay))
					TargetDelays.Add(delay);
				else
					SourceDelays.Add(delay);
			}
			TargetDelays.Sort(x => x.No);
			SourceDelays.Sort(x => x.No);

			SelectedTargetDelay = TargetDelays.FirstOrDefault();
			SelectedSourceDelay = SourceDelays.FirstOrDefault();
		}
		public GuardZonesSelectationViewModel(List<GKGuardZone> guardZones)
		{
			Title = "Выбор охранных зон";
			AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
			RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
			AddAllCommand = new RelayCommand(OnAddAll, CanAddAll);
			RemoveAllCommand = new RelayCommand(OnRemoveAll, CanRemoveAll);
			CreateNewCommand = new RelayCommand(OnCreateNew);

			GuardZones = guardZones;
			TargetZones = new SortableObservableCollection<GKGuardZone>();
			SourceZones = new SortableObservableCollection<GKGuardZone>();

			foreach (var guardZone in GKManager.GuardZones)
			{
				if (GuardZones.Contains(guardZone))
					TargetZones.Add(guardZone);
				else
					SourceZones.Add(guardZone);
			}
			TargetZones.Sort(x => x.No);
			SourceZones.Sort(x => x.No);

			SelectedTargetZone = TargetZones.FirstOrDefault();
			SelectedSourceZone = SourceZones.FirstOrDefault();
		}
Example #21
0
		public void Initialize()
		{
			IsNowPlaying = false;
			Sounds = new SortableObservableCollection<SoundViewModel>();
			var stateClasses = new List<Tuple<XStateClass, SoundType>>();

			stateClasses.Add(new Tuple<XStateClass, SoundType>(XStateClass.Fire1, SoundType.Fire1));
			stateClasses.Add(new Tuple<XStateClass, SoundType>(XStateClass.Fire2, SoundType.Fire2));
			stateClasses.Add(new Tuple<XStateClass, SoundType>(XStateClass.Attention, SoundType.Attention));
			stateClasses.Add(new Tuple<XStateClass, SoundType>(XStateClass.Fire1, SoundType.Alarm));
			stateClasses.Add(new Tuple<XStateClass, SoundType>(XStateClass.Failure, SoundType.Failure));
			stateClasses.Add(new Tuple<XStateClass, SoundType>(XStateClass.Off, SoundType.Off));
			stateClasses.Add(new Tuple<XStateClass, SoundType>(XStateClass.TurningOn, SoundType.TurningOn));
			stateClasses.Add(new Tuple<XStateClass, SoundType>(XStateClass.TurningOff, SoundType.StopStart));
			stateClasses.Add(new Tuple<XStateClass, SoundType>(XStateClass.AutoOff, SoundType.AutoOff));

			foreach (var stateClass in stateClasses)
			{
				var newSound = new Sound() { StateClass = stateClass.Item1, Type = stateClass.Item2 };

				var sound = ClientManager.SystemConfiguration.Sounds.FirstOrDefault(x => x.Type == stateClass.Item2);
				if (sound == null)
					ClientManager.SystemConfiguration.Sounds.Add(newSound);
				else
					newSound = sound;

				Sounds.Add(new SoundViewModel(newSound));
			}

			Sounds.Sort(x => EnumHelper.GetEnumDescription(x.SoundType));
			SelectedSound = Sounds.FirstOrDefault();

			if (ClientManager.SystemConfiguration.Sounds.RemoveAll(x => !Sounds.Any(y => y.SoundType == x.Type)) > 0)
				ServiceFactory.SaveService.SoundsChanged = true;
		}
Example #22
0
        private void Timer_Elapsed(object sender, EventArgs e)
        {
            if (ChangeTracker.Is34Mode || ChangeTracker.IsLandscapeMode)
            {
                var foundMatchdayMatches = new SortableObservableCollection <IMatchVw>();
                Repository.FindMatches(foundMatchdayMatches, "", SelectedLanguage, PrevMatchFilter, Comparison);
                if (foundMatchdayMatches.Count > 0)
                {
                    var previousMatchdayMatches = new SortableObservableCollection <IMatchVw>();
                    PrevMatchDay = foundMatchdayMatches.Last().VirtualDay;
                    PrevSeason   = foundMatchdayMatches.Last().VirtualSeason;
                    for (int i = foundMatchdayMatches.Count - 1; i >= 0; i--)
                    {
                        if (foundMatchdayMatches[i].VirtualDay == PrevMatchDay && foundMatchdayMatches[i].VirtualSeason == PrevSeason)
                        {
                            previousMatchdayMatches.Add(foundMatchdayMatches[i]);
                        }
                        else
                        {
                            break;
                        }
                    }


                    ConvertMatchesToButtons(previousMatchdayMatches, VflMatchButtons);
                }
            }
        }
Example #23
0
		public AreaOption()
		{
			DataType = "Workshare.Configuration.Shell.Model.AreaOption";
			SubOptions = new SortableObservableCollection<IOption>() {null, null, null};
			_resetSession = new ResetSessionCommand(this);
			_select = new SelectCommand(this);
			IsEnabled = true;
		}
Example #24
0
        public MainViewModel()
        {
            HelpViewa    = new HelpView();
            SettingsView = new SettingsView();

            StatusMessage = "Checking for new addon updates.....";
            LocalAddons   = new SortableObservableCollection <AddonMetaData>();
        }
Example #25
0
		public OptionGroupInstance()
		{
			DataType = "Workshare.Configuration.Shell.Model.OptionGroupInstance";
			IsEnabled = true;
            SubOptions = new SortableObservableCollection<IOption>();

            SubOptions.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SubOptions_CollectionChanged);
		}
Example #26
0
        public MainViewModel()
        {
            HelpViewa = new HelpView();
            SettingsView = new SettingsView();

            StatusMessage = "Checking for new addon updates.....";
            LocalAddons = new SortableObservableCollection<AddonMetaData>();
        }
        public void SortPausedSoccerLiveMonitor()
        {
            SortableObservableCollection <IMatchVw> collection = new SortableObservableCollection <IMatchVw>();

            collection.Add(new TestMatchVw()
            {
                SportDescriptor = SportSr.SPORT_DESCRIPTOR_SOCCER, IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 45, LivePeriodInfo = eLivePeriodInfo.Soccer_1st_Period, Name = "test1", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 2)
            });                                                                                                                                                                                                                                                                                                                                                                                         //should be third
            collection.Add(new TestMatchVw()
            {
                SportDescriptor = SportSr.SPORT_DESCRIPTOR_SOCCER, IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 45, LivePeriodInfo = eLivePeriodInfo.Paused, Name = "test2", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 1)
            });                                                                                                                                                                                                                                                                                                                                                                              //should be second
            collection.Add(new TestMatchVw()
            {
                SportDescriptor = SportSr.SPORT_DESCRIPTOR_SOCCER, IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 20, LivePeriodInfo = eLivePeriodInfo.Soccer_1st_Period, Name = "test3", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 2)
            });                                                                                                                                                                                                                                                                                                                                                                                         //should be forth
            collection.Add(new TestMatchVw()
            {
                SportDescriptor = SportSr.SPORT_DESCRIPTOR_SOCCER, IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 50, LivePeriodInfo = eLivePeriodInfo.Soccer_2nd_Period, Name = "test4", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 1)
            });                                                                                                                                                                                                                                                                                                                                                                                         //should be first

            var groupln = new GroupLn {
                Sort = { Value = 1 }
            };

            collection.Sort(LiveMonitorsService.Comparison);

            Assert.AreEqual("test4", collection[0].Name); //s
            Assert.AreEqual("test2", collection[1].Name); //s
            Assert.AreEqual("test1", collection[2].Name); //s
            Assert.AreEqual("test3", collection[3].Name); //s
        }
Example #28
0
 public JournalViewModel()
 {
     SelectedDay = DateTime.Today;
     Entries     = new SortableObservableCollection <JournalEntry>()
     {
         SortingSelector = x => x.Date,
         Descending      = true
     };
     Entries.CollectionChanged += OnEntriesChanged;
 }
Example #29
0
		public void Update()
		{
			Parts = new SortableObservableCollection<SchedulePartViewModel>();
			foreach (var schedulePart in Schedule.ScheduleParts.OrderBy(x => x.DayNo))
			{
				var schedulePartViewModel = new SchedulePartViewModel(Schedule, schedulePart);
				Parts.Add(schedulePartViewModel);
			}
			SelectedPart = Parts.FirstOrDefault();
		}
Example #30
0
        public void SearchOdds(SortableObservableCollection <IOddVw> ocOdds, DelegateFilterOdds dfo)
        {
#if DEBUG
            if (this.BetDomainId == 811116)
            {
            }
#endif

            var hsOdds    = new HashSet <IOddVw>();
            var lOdds     = m_objLine.Odds.Clone();
            var lOddViews = ocOdds.ToSyncList();

            foreach (var oddLn in lOdds)
            {
                if (dfo == null || dfo(oddLn))
                {
                    hsOdds.Add(oddLn.OddView);

                    if (!lOddViews.Contains(oddLn.OddView))
                    {
                        lOddViews.Add(oddLn.OddView);
                    }
                }
            }

            for (int i = 0; i < lOddViews.Count;)
            {
                IOddVw oddView = lOddViews[i];

                if (!hsOdds.Contains(oddView))
                {
                    lOddViews.RemoveAt(i);
                }
                else
                {
                    i++;
                }
            }

            if (this.LineObject.IsLiveBet.Value)
            {
                lOddViews.Sort(delegate(IOddVw ov1, IOddVw ov2) { return(ov1.LineObject.Sort.Value.CompareTo(ov2.LineObject.Sort.Value)); });
            }
            else if (this.IsOutright)
            {
                lOddViews.Sort(delegate(IOddVw ov1, IOddVw ov2) { return(ov1.LineObject.Value.Value.CompareTo(ov2.LineObject.Value.Value)); });
            }
            else
            {
                lOddViews.Sort(delegate(IOddVw ov1, IOddVw ov2) { return(ov1.LineObject.Sort.Value.CompareTo(ov2.LineObject.Sort.Value)); });
            }

            ocOdds.ApplyChanges(lOddViews);
        }
Example #31
0
 public void Setup()
 {
     this.c = new SortableObservableCollection <int>
     {
         5,
         4,
         3,
         2,
         1
     };
 }
Example #32
0
        public void SearchMatches(SortableObservableCollection <IMatchVw> ocMatches, string sSearch, string sLanguage, DelegateFilterMatches dfm, Comparison <IMatchVw> comparison)
        {
            SyncList <IMatchVw> lMatchesToSync = ocMatches.ToSyncList();

            SearchMatches(lMatchesToSync, sSearch, sLanguage, dfm);

            if (comparison != null)
            {
                lMatchesToSync.Sort(comparison);
            }
            ocMatches.ApplyChanges(lMatchesToSync);
        }
Example #33
0
        public void SearchResults(SortableObservableCollection <MatchResultVw> ocMatchResults, DelegateFilterResults dfr, Comparison <MatchResultVw> comparison)
        {
            SyncList <MatchResultVw> lResultsToSync = ocMatchResults.ToSyncList();

            SearchResults(lResultsToSync, dfr);

            if (comparison != null)
            {
                lResultsToSync.Sort(comparison);
                ocMatchResults.ApplyChanges(lResultsToSync);
            }
        }
Example #34
0
        private void SelectedItemChanged(RoutedPropertyChangedEventArgs <object> obj)
        {
            object selected = obj.NewValue;

            if (selected == null)
            {
                return;
            }

            if (selected is SimpleTreeNodeViewModel)
            {
                SimpleTreeNodeViewModel tvm = (SimpleTreeNodeViewModel)selected;
                _selectedNode = tvm;
                if (tvm.Node is Model.Feed)
                {
                    Articles = new SortableObservableCollection <Model.Article>(((Model.Feed)tvm.Node).Articles);
                }
                else if (tvm.Node is Model.Host)
                {
                    List <Model.Article> intermediate = new List <Model.Article>();
                    foreach (Model.Feed feed in ((Model.Host)tvm.Node).Feeds)
                    {
                        foreach (Model.Article a in feed.Articles)
                        {
                            intermediate.Add(a);
                        }
                    }
                    Articles = new SortableObservableCollection <Model.Article>(intermediate);
                }
                else
                {
                    if (_articles == null)
                    {
                        _articles = new SortableObservableCollection <Article>();
                    }
                    _articles.Clear();
                    foreach (Model.Host h in _allData)
                    {
                        foreach (Model.Feed feed in h.Feeds)
                        {
                            foreach (Model.Article a in feed.Articles)
                            {
                                _articles.Add(a);
                            }
                        }
                    }
                }
                SortedArticles.SortDescriptions.Clear();                                                           // Clear all
                SortedArticles.SortDescriptions.Add(new SortDescription("SortKey", ListSortDirection.Descending)); // Sort descending by "PropertyName"
                //Articles.OrderByDescending(el => el.SortKey);
            }
            RaisePropertyChanged("SortedArticles");
        }
Example #35
0
        public void GenerateTickets()
        {
            MainWindow window = new MainWindow();
            var        random = new Random();

            window.generator = new KenoLoader();
            var generator = (KenoLoader)window.generator;

            generator.Path = "test.xml";
            generator.Load();
            var player = new Player()
            {
                Name = "Loaded4", NumberOfTickets = 28, Stake = 1, Money = 100, System = 6, HotNumbers = 7, ColdNumbers = 0, HotRange = 11, ColdRange = 21, StatRange = 1
            };

            for (int i = 7800; i < generator.results.Count; i++)
            {
                var numbers = window.generator.Generate();
                foreach (var numberStat in window.NumbersStatistic)
                {
                    numberStat.Appear(numbers.Contains(numberStat.Number));
                }
                var tempStat = new SortableObservableCollection <NumberStat>();
                tempStat.Sync(window.NumbersStatistic);
                tempStat.Sort(x => x.TimesAppear(player.StatRange), ListSortDirection.Descending);

                window.GenerateNumbersBuyTickets(player, window.NumbersStatistic, random);
                var wonMoney = Calculate.CalculateTickets(numbers, player.Tickets);
                Console.WriteLine(wonMoney);
            }


            //foreach (var ticket in player.Tickets)
            //{
            //    foreach (var number in ticket.Numbers)
            //    {
            //        Console.Write(number + ";");
            //    }
            //    Console.WriteLine("\t" + ticket.wonNumbers + " " + ticket.wonAmount);
            //}
            Console.WriteLine();

            window.GenerateNumbersBuyTickets(player, window.NumbersStatistic, random);

            foreach (var ticket in player.Tickets)
            {
                foreach (var number in ticket.Numbers)
                {
                    Console.Write(number + " ");
                }
                Console.WriteLine();
            }
        }
Example #36
0
        public void FillSportsBar()
        {
            SortableObservableCollection <MatchResultVw> ResultMatches = new SortableObservableCollection <MatchResultVw>();

            Repository.FindResults(ResultMatches, SportBarMatchFilter, Comparison);
            Dispatcher.Invoke(() =>
            {
                try
                {
                    var sports = ResultMatches.Where(x => x.SportView != null).Select(x => x.SportView).Distinct().ToList();

                    SportBarItem allsports = SportsBarItems.FirstOrDefault(x => x.SportDescriptor == SportSr.ALL_SPORTS);
                    if (allsports != null)
                    {
                        allsports.SportName = TranslationProvider.Translate(MultistringTags.ALL_SPORTS) as string;
                    }

                    foreach (var group in sports)
                    {
                        if (SportsBarItems.Count(x => x.SportDescriptor == group.LineObject.GroupSport.SportDescriptor) == 0)
                        {
                            SportsBarItems.Add(new SportBarItem(group.DisplayName, group.LineObject.GroupSport.SportDescriptor));
                        }
                        else
                        {
                            SportsBarItems.First(x => x.SportDescriptor == @group.LineObject.GroupSport.SportDescriptor).SportName = @group.DisplayName;
                        }
                    }

                    for (int i = 1; i < SportsBarItems.Count;)
                    {
                        var item = SportsBarItems[i];

                        if (sports.Count(x => x.LineObject.GroupSport.SportDescriptor == item.SportDescriptor) == 0)
                        {
                            SportsBarItems.RemoveAt(i);
                        }
                        else
                        {
                            i++;
                        }
                    }

                    SportsBarItems.Sort(ComparisonSportsBar);

                    OnPropertyChanged("SportsBarVisibility");
                }
                catch (Exception ex)
                {
                }
            });
        }
Example #37
0
        public PointProfile()
        {
            _profile = new SortableObservableCollection <Point>();
            Key      = -1;
            _origin  = new Point(0, 0);
            _outline = new Path();
            _outline.StrokeThickness = 1;

            _currentItem = new Nullable <Point>();
            _newItem     = new Nullable <Point>();
            _xdescending = new PointXDescending();
            _xascending  = new PointXAscending();
        }
Example #38
0
        public CurrencyEditViewModel(INavigator navigator, ICommandDispatcher commandDispatcher, MessageBuilder messageBuilder, IQueryDispatcher queryDispatcher, string uniqueCode, string symbol)
        {
            Ensure.NotNull(navigator, "navigator");
            Ensure.NotNull(commandDispatcher, "commandDispatcher");
            Ensure.NotNull(queryDispatcher, "queryDispatcher");
            this.queryDispatcher = queryDispatcher;
            UniqueCode           = uniqueCode;
            Symbol        = symbol;
            ExchangeRates = new SortableObservableCollection <ExchangeRateModel>();

            CreateCommands(navigator, commandDispatcher, messageBuilder);
            LoadExchangeRateList();
        }
Example #39
0
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="navigator">An instance of the navigator.</param>
        /// <param name="key">A key of the category</param>
        /// <param name="name">A name of the category.</param>
        /// <param name="period">A period displayed (year or month).</param>
        public OverviewViewModel(INavigator navigator, IKey key, string name, object period)
            : base(navigator, key)
        {
            Ensure.NotNull(key, "key");
            Key    = key;
            Name   = name;
            Period = period;
            Items  = new SortableObservableCollection <OutcomeOverviewViewModel>();

            if (!key.IsEmpty)
            {
                EditCategory = new NavigateCommand(navigator, new CategoryListParameter(key));
            }
        }
Example #40
0
        private void OnCountryChoiceExecute(object parameters)
        {
            var arr     = (object[])parameters;
            var country = (string)arr[0];
            var id      = (long)arr[1];

            if (country != "Outrights" && country != "")
            {
                SelectedTournaments = new SortableObservableCollection <TournamentVw>(Tournaments.Where(a => a.Country == country));
            }
            else
            {
                SelectedTournaments = new SortableObservableCollection <TournamentVw>(Tournaments.Where(a => a.Id == id));
            }
        }
        private IEnumerable <MatchResultVw> FilterFoundResults(
            SortableObservableCollection <MatchResultVw> notFilteredResults,
            string translatedSportName)
        {
            var res = new List <MatchResultVw>(notFilteredResults.Count);

            foreach (var matchResultView in notFilteredResults)
            {
                if (matchResultView.SportView.DisplayName == translatedSportName)
                {
                    res.Add(matchResultView);
                }
            }

            return(res);
        }
Example #42
0
        public ModListViewModel(ISettings settings, IModDatabase db, IInstaller inst, IModSource mods)
        {
            _settings  = settings;
            _installer = inst;
            _mods      = mods;
            _db        = db;

            _items = new SortableObservableCollection <ModItem>(db.Items.OrderBy(ModToOrderedTuple));

            SelectedItems = _selectedItems = _items;

            OnInstall  = ReactiveCommand.CreateFromTask <ModItem>(OnInstallAsync);
            ToggleApi  = ReactiveCommand.Create(ToggleApiCommand);
            ChangePath = ReactiveCommand.CreateFromTask(ChangePathAsync);
            UpdateApi  = ReactiveCommand.CreateFromTask(UpdateApiAsync);
        }
Example #43
0
 /// <summary>
 /// Initialises a new instance of the <see cref="SessionModel"/> class.
 /// </summary>
 public SessionModel()
 {
     InnerDrivers = new SortableObservableCollection<DriverModel>((x, y) => { return x.Position.CompareTo(y.Position); });
     Drivers = new ReadOnlyObservableCollection<DriverModel>(InnerDrivers);
     DriversById = new Dictionary<int, DriverModel>(25);
     Feed = new FeedModel();
     Grid = GridModelBase.Create(SessionType.None);
     FastestTimes = new FastestTimesModel(this);
     Messages = new MessageModel();
     OneSecondTimer = new DispatcherTimer(DispatcherPriority.Normal);
     OneSecondTimer.Interval = OneSecond;
     OneSecondTimer.Tick += (s, e) => OnOneSecondElapsed();
     SessionStatus = SessionStatus.Finished;
     SpeedCaptures = new SpeedCapturesModel(this);
     Weather = new WeatherModel();
     Builder = new SessionModelBuilder(this);
 }
		public GuardZonesWithFuncSelectationViewModel(GKDevice device, bool canCreateNew = false)
		{
			Title = "Выбор охранных зон";
			AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
			RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
			AddAllCommand = new RelayCommand(OnAddAll, CanAddAll);
			RemoveAllCommand = new RelayCommand(OnRemoveAll, CanRemoveAll);
			CreateNewCommand = new RelayCommand(OnCreateNew);

			Device = device;
			DeviceGuardZones = new ObservableCollection<DeviceGuardZoneViewModel>();
			foreach (var zone in device.GuardZones)
			{
				var guardZoneDevice = zone.GuardZoneDevices.FirstOrDefault(x => x.Device == device);
				if (guardZoneDevice != null)
				{
					var deviceGuardZone = new GKDeviceGuardZone();
					deviceGuardZone.GuardZone = zone;
					deviceGuardZone.GuardZoneUID = zone.UID;
					deviceGuardZone.ActionType = guardZoneDevice.ActionType;
					deviceGuardZone.CodeReaderSettings = guardZoneDevice.CodeReaderSettings;
					DeviceGuardZones.Add(new DeviceGuardZoneViewModel(deviceGuardZone, device));
				}
			}

			CanCreateNew = canCreateNew;
			TargetZones = new SortableObservableCollection<DeviceGuardZoneViewModel>();
			SourceZones = new SortableObservableCollection<DeviceGuardZoneViewModel>();

			foreach (var guardZone in GKManager.GuardZones)
			{
				var deviceGuardZone = DeviceGuardZones.FirstOrDefault(x => x.DeviceGuardZone.GuardZone == guardZone);
				if (deviceGuardZone != null)
					TargetZones.Add(deviceGuardZone);
				else
				{
					var gkDeviceGuardZone = new GKDeviceGuardZone();
					gkDeviceGuardZone.GuardZone = guardZone;
					gkDeviceGuardZone.GuardZoneUID = guardZone.UID;
					SourceZones.Add(new DeviceGuardZoneViewModel(gkDeviceGuardZone, device));
				}
			}

			SelectedTargetZone = TargetZones.FirstOrDefault();
			SelectedSourceZone = SourceZones.FirstOrDefault();
		}
Example #45
0
        // Герерация структуры дерева из таблицы БД
        public void GenerateTree()
        {
            db.Collects.Load();

            IEnumerable <Collect> list = db.Collects.Local;

            SortableObservableCollection <INode> tree = new SortableObservableCollection <INode>();

            foreach (Collect t in db.Collects.Local.Where(t => t.Parent_id is null)) // выбираем корневые узлы дерева
            {
                CNode node = new CNode();
                node.Id       = t.Id;
                node.Name     = t.Collect_name;
                node.Children = GetChildren(t.Id, list); // поискпотомков корневого узла
                tree.Add(node);
            }
            tree.Sort(t => t.Name);
            treeColl.ItemsSource = tree;
        }
Example #46
0
            /// <summary>
            /// 重複しないように新しいIDを生成
            /// </summary>
            /// <returns></returns>
            int GenerateNewId(SortableObservableCollection dataList)
            {
                List<int> idList = new List<int>();
                for (int index = 0; index < dataList.Count; index++)
                {
                    idList.Add(dataList[index].ID);
                }

                int id = 0;
                while (true)
                {
                    if (!idList.Contains(id))
                    {
                        break;
                    }
                    id++;
                }

                return id;
            }
Example #47
0
        private SortableObservableCollection <IMatchVw> FillCategoryWithTournaments(TestGroupVw category, int amount)
        {
            SortableObservableCollection <IMatchVw> collection = new SortableObservableCollection <IMatchVw>();

            for (int i = 0; i < amount; i++)
            {
                collection.Add(new TestMatchVw()
                {
                    SportDescriptor = "SPRT_SOCCER",
                    DefaultSorting  = i,
                    IsLiveBet       = false,
                    IsOutright      = false,
                    Name            = "test1",
                    CategoryView    = category,
                    SportView       = new TestGroupVw()
                    {
                        DisplayName = "s", LineObject = new GroupLn()
                        {
                            GroupId = 1, Sort = new ObservableProperty <int>(new GroupLn(), new ObservablePropertyList(), "test")
                            {
                                Value = 3
                            }
                        }
                    },
                    StartDate      = new DateTime(2015, 1, 2),
                    TournamentView = new TestGroupVw()
                    {
                        DisplayName = "tournament" + i.ToString(), LineObject = new GroupLn()
                        {
                            GroupId = i, Sort = new ObservableProperty <int>(new GroupLn(), new ObservablePropertyList(), "test")
                            {
                                Value = i
                            }
                        }
                    },
                    ExpiryDate = DateTime.Now.AddDays(365)
                });
            }

            return(collection);
        }
		public DoorsSelectationViewModel(List<GKDoor> doors, List<GKDoorType> doorsTypes = null)
		{
			Title = "Выбор точек доступа";
			AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
			RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
			AddAllCommand = new RelayCommand(OnAddAll, CanAddAll);
			RemoveAllCommand = new RelayCommand(OnRemoveAll, CanRemoveAll);
			CreateNewCommand = new RelayCommand(OnCreateNew);

			Doors = doors;
			TargetDoors = new SortableObservableCollection<GKDoor>();
			SourceDoors = new SortableObservableCollection<GKDoor>();

			var allDoors = GKManager.DeviceConfiguration.Doors;
			if (doorsTypes != null)
			{
				var filteredDoors = new List<GKDoor>();
				foreach (var door in allDoors)
					foreach (var doorType in doorsTypes)
					{
						if (door.DoorType == doorType)
						{
							filteredDoors.Add(door);
							break;
						}
					}
				allDoors = filteredDoors;
			}
			foreach (var door in allDoors)
			{
				if (Doors.Contains(door))
					TargetDoors.Add(door);
				else
					SourceDoors.Add(door);
			}
			TargetDoors.Sort(x => x.No);
			SourceDoors.Sort(x => x.No);

			SelectedTargetDoor = TargetDoors.FirstOrDefault();
			SelectedSourceDoor = SourceDoors.FirstOrDefault();
		}
Example #49
0
		public Category()
		{
            SubCategories = new SortableObservableCollection<Category>();
            Options = new SortableObservableCollection<IOption>();
			Options.CollectionChanged += OnOptionsCollectionChanged;
		}
Example #50
0
		void UpdateGrid()
		{
			using (new WaitWrapper())
			{
				var employeeUID = Guid.Empty;

				if (SelectedTimeTrack != null)
				{
					employeeUID = SelectedTimeTrack.ShortEmployee.UID;
				}

				TotalDays = (int)(TimeTrackFilter.EndDate - TimeTrackFilter.StartDate).TotalDays + 1;
				FirstDay = TimeTrackFilter.StartDate;

				TimeTracks = new SortableObservableCollection<TimeTrackViewModel>();
				var stream = ClientManager.RubezhService.GetTimeTracksStream(TimeTrackFilter.EmployeeFilter, TimeTrackFilter.StartDate, TimeTrackFilter.EndDate);
				var folderName = AppDataFolderHelper.GetFolder("TempServer");
				var resultFileName = Path.Combine(folderName, "ClientTimeTrackResult.xml");
				var resultFileStream = File.Create(resultFileName);
				CopyStream(stream, resultFileStream);
				var timeTrackResult = Deserialize(resultFileName);

				if (timeTrackResult != null)
				{
					TimeTrackEmployeeResults = timeTrackResult.TimeTrackEmployeeResults;
					foreach (var timeTrackEmployeeResult in TimeTrackEmployeeResults)
					{
						var timeTrackViewModel = new TimeTrackViewModel(TimeTrackFilter, timeTrackEmployeeResult);
						TimeTracks.Add(timeTrackViewModel);
					}

					TimeTracks.Sort(x => x.ShortEmployee.LastName);
					RowHeight = 60 + 20 * TimeTrackFilter.TotalTimeTrackTypeFilters.Count;
				}

				SelectedTimeTrack = TimeTracks.FirstOrDefault(x => x.ShortEmployee.UID == employeeUID) ??
									TimeTracks.FirstOrDefault();
			}
		}
Example #51
0
 public MasterBoolOption(string name, bool value, bool defaultValue, bool canOverride) : base (name, value, defaultValue, canOverride)
 {
     SubOptions = new SortableObservableCollection<IOption>();
 }
Example #52
0
        private void SelectedItemChanged(RoutedPropertyChangedEventArgs<object> obj)
        {
            object selected = obj.NewValue;

            if (selected == null)
                return;

            if (selected is SimpleTreeNodeViewModel)
            {
                SimpleTreeNodeViewModel tvm = (SimpleTreeNodeViewModel)selected;
                _selectedNode = tvm;
                if (tvm.Node is Model.Feed)
                {
                    Articles = new SortableObservableCollection<Model.Article>(((Model.Feed)tvm.Node).Articles);
                }
                else if (tvm.Node is Model.Host)
                {
                    List<Model.Article> intermediate = new List<Model.Article>();
                    foreach (Model.Feed feed in ((Model.Host)tvm.Node).Feeds)
                    {
                        foreach (Model.Article a in feed.Articles)
                        {
                            intermediate.Add(a);
                        }
                    }
                    Articles = new SortableObservableCollection<Model.Article>(intermediate);
                }
                else
                {
                    if (_articles == null)
                        _articles = new SortableObservableCollection<Article>();
                    _articles.Clear();
                    foreach (Model.Host h in _allData)
                    {
                        foreach (Model.Feed feed in h.Feeds)
                        {
                            foreach (Model.Article a in feed.Articles)
                            {
                                _articles.Add(a);
                            }
                        }
                    }
                }
                SortedArticles.SortDescriptions.Clear(); // Clear all 
                SortedArticles.SortDescriptions.Add(new SortDescription("SortKey", ListSortDirection.Descending)); // Sort descending by "PropertyName"
                //Articles.OrderByDescending(el => el.SortKey);
            }
            RaisePropertyChanged("SortedArticles");
        }
Example #53
0
        private void LoadDataInBackground()
        {
            SmartDispatcher.BeginInvoke(() =>
            {
                //GlobalLoading.Instance.IsLoadingText(Strings.SyncingTasks);

                if (App.RtmClient.TaskLists != null)
                {
                    var tempAllTasks = new SortableObservableCollection<Task>();
                    var tempTaskLists = new SortableObservableCollection<TaskList>();
                    var tempTaskTags = new SortableObservableCollection<TaskTag>();

                    foreach (TaskList l in App.RtmClient.TaskLists)
                    {
                        if (l.Tasks != null &&
                            l.IsNormal == true)
                        {
                            foreach (Task t in l.Tasks)
                            {
                                if (t.IsCompleted == true ||
                                    t.IsDeleted == true) continue;

                                if (t.DueDateTime.HasValue &&
                                    t.DueDateTime.Value.Date <= DateTime.Now.AddDays(1).Date)
                                {
                                    tempAllTasks.Add(t);
                                }
                            }
                        }

                        if (l.Name.ToLower() == "all tasks")
                            tempTaskLists.Insert(0, l);
                        else
                            tempTaskLists.Add(l);
                    }

                    //tempAllTasks.Sort(Task.CompareByDate);

                    // insert the nearby list placeholder
                    TaskList nearby = new TaskList("Nearby");
                    tempTaskLists.Insert(1, nearby);

                    foreach (var tag in App.RtmClient.GetTasksByTag().OrderBy(z => z.Key))
                    {
                        TaskTag data = new TaskTag();
                        data.Name = tag.Key;
                        data.Count = tag.Value.Count;

                        tempTaskTags.Add(data);
                    }

                    AllTasks = tempAllTasks;
                    TaskLists = tempTaskLists;
                    TaskTags = tempTaskTags;

                    ToggleLoadingText();
                    ToggleEmptyText();

                    //GlobalLoading.Instance.IsLoading = false;

                    ShowLastUpdatedStatus();
                }
            });
        }
Example #54
0
        public void LoadListView(TwitterListExtended twitterListExt)
        {
            _tweetSender.txtSearchBox.Text = "";
            _userProfileView.Visibility = Visibility.Collapsed;
            _accountInfo.SelectPanel();

            SortableObservableCollection<TwitterStatus> listStatusCollections;

            TOBBaseObject Twitter = AccountManager.Instance.GetTOBObject(twitterListExt.UserAccount);
            var twitterLists = Twitter.GetStatusesFromList(twitterListExt.User.ScreenName, (long)twitterListExt.Id);
            if (twitterLists == null)
            {
                return;
            }

            string listPanelKey = "LISTPANEL" + twitterListExt.Id;
            UserAllTweets listView;

            if (_panelViewDict.ContainsKey(listPanelKey))
            {
                listView = _panelViewDict[listPanelKey];
            }
            else
            {
                listView = new UserAllTweets();
                //listView.DataTemplate = listView.FindResource("GroupsStatusesDataTemplate") as DataTemplate;

                listView.CollectionTypeFilter = TOBEntityEnum.None;

                _panelViewDict.Add(listPanelKey, listView);
            }

            listStatusCollections = new SortableObservableCollection<TwitterStatus>(twitterLists.ToList());
            listView.ListStatusCollection = listStatusCollections;
            _currentTweetsView = listView;
            _mainWindow.frmTOBMain.Content = listView;
        }
Example #55
0
        public void LoadFindPeople(string query)
        {
            try
            {
                List<TwitterUser> users = null;

                foreach (TOBBaseObject tobObj in AccountManager.Instance.TobObjects)
                {
                    users = tobObj.QueryUsers(query);

                    if (users != null)
                    {
                        break;
                    }
                }

                if (users == null)
                {
                    MessageBox.Show("No users found");
                    return;
                }

                string queryUserPanelKey = "QUERYUSERPANEL";
                UserAllTweets queryUserView;

                if (_panelViewDict.ContainsKey(queryUserPanelKey))
                {
                    queryUserView = _panelViewDict[queryUserPanelKey];
                }
                else
                {
                    queryUserView = new UserAllTweets();
                    //queryUserView.DataTemplate = queryUserView.FindResource("QueryUserDataTemplate") as DataTemplate;

                    queryUserView.CollectionTypeFilter = TOBEntityEnum.None;

                    _panelViewDict.Add(queryUserPanelKey, queryUserView);
                }

                SortableObservableCollection<TwitterUser> peopleCollections;

                peopleCollections = new SortableObservableCollection<TwitterUser>(users);
                queryUserView.PeopleCollection = peopleCollections;

                _currentTweetsView = queryUserView;
                _mainWindow.frmTOBMain.Content = queryUserView;
                _tweetSender.ChangeGlobelSearchType(1);
                _tweetSender.txtSearchBox.Text = query;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #56
0
        public void LoadSavedSearchView(SavedSearch ssPanel)
        {
            _accountInfo.SelectPanel();
            string savedsearchPanelKey = "SAVEDSEARCHPANEL" + ssPanel.Id;
            UserAllTweets savedsearchView;

            if (_panelViewDict.ContainsKey(savedsearchPanelKey))
            {
                savedsearchView = _panelViewDict[savedsearchPanelKey];
            }
            else
            {
                savedsearchView = new UserAllTweets();
                //savedsearchView.DataTemplate = savedsearchView.FindResource("SavedSearchDataTemplate") as DataTemplate;

                savedsearchView.CollectionTypeFilter = TOBEntityEnum.None;

                _panelViewDict.Add(savedsearchPanelKey, savedsearchView);
            }

            SortableObservableCollection<TwitterSearchStatus> searchCollections;
            searchCollections = new SortableObservableCollection<TwitterSearchStatus>(GetSearchList(ssPanel.SearchText));

            savedsearchView.SearchCollection = searchCollections;
            _currentTweetsView = savedsearchView;
            _mainWindow.frmTOBMain.Content = savedsearchView;
            _tweetSender.ChangeGlobelSearchType(-1);
            _tweetSender.txtSearchBox.Text = ssPanel.SearchText;
        }
Example #57
0
        public void SearchUserByUserName(string username)
        {
            //Anand: Temp hack, need to fix asap.
            TwitterUser tup = null;
            List<TwitterSearchStatus> tupStatus = null;
            foreach (TOBBaseObject tobObj in AccountManager.Instance.TobObjects)
            {
                tup = tobObj.SearchUser(username);
                if (tup == null)
                {
                    continue;
                }
                tupStatus = tobObj.GetStatuses(username);
            }

            if (tup == null)
                return;

            _userProfileView.SetUserDetails(tup);
            _userProfileView.Visibility = Visibility.Visible;
            UserAllTweets savedsearchView;
            savedsearchView = new UserAllTweets();
            savedsearchView.DataTemplate = savedsearchView.FindResource("SavedSearchDataTemplate") as DataTemplate;
            SortableObservableCollection<TwitterSearchStatus> searchCollections;
            searchCollections = new SortableObservableCollection<TwitterSearchStatus>(tupStatus);
            savedsearchView.SearchCollection = searchCollections;
            _currentTweetsView = savedsearchView;
            _mainWindow.frmTOBMain.Content = savedsearchView;
        }
        private void LoadDataInBackground()
        {
            if (App.RtmClient.TaskLists != null)
            {
                var tempTaskLists = new SortableObservableCollection<TaskList>();

                var tempOverdueTasks = new SortableObservableCollection<Task>();
                var tempTodayTasks = new SortableObservableCollection<Task>();
                var tempTomorrowTasks = new SortableObservableCollection<Task>();
                var tempWeekTasks = new SortableObservableCollection<Task>();
                var tempNoDueTasks = new SortableObservableCollection<Task>();

                var tempTags = new SortableObservableCollection<string>();

                foreach (TaskList l in App.RtmClient.TaskLists)
                {
                    tempTaskLists.Add(l);

                    if (l.IsNormal && l.Tasks != null)
                    {
                        foreach (Task task in l.Tasks)
                        {
                            // add tags
                            foreach (string tag in task.Tags)
                            {
                                if (!tempTags.Contains(tag)) tempTags.Add(tag);
                            }

                            if (task.IsIncomplete)
                            {
                                if (task.DueDateTime.HasValue)
                                {
                                    // overdue
                                    if (task.DueDateTime.Value < DateTime.Today || (task.HasDueTime && task.DueDateTime.Value < DateTime.Now))
                                    {
                                        tempOverdueTasks.Add(task);
                                    }
                                    // today
                                    else if (task.DueDateTime.Value.Date == DateTime.Today)
                                    {
                                        tempTodayTasks.Add(task);
                                    }
                                    // tomorrow
                                    else if (task.DueDateTime.Value.Date == DateTime.Today.AddDays(1))
                                    {
                                        tempTomorrowTasks.Add(task);
                                    }
                                    // this week
                                    else if (task.DueDateTime.Value.Date > DateTime.Today.AddDays(1) && task.DueDateTime.Value.Date <= DateTime.Today.AddDays(6))
                                    {
                                        tempWeekTasks.Add(task);
                                    }
                                }
                                else
                                {
                                    // no due
                                    tempNoDueTasks.Add(task);
                                }
                            }
                        }
                    }
                }

                tempOverdueTasks.Sort();
                tempTodayTasks.Sort();
                tempTomorrowTasks.Sort();
                tempWeekTasks.Sort();
                tempNoDueTasks.Sort();

                tempTags.Sort();

                SmartDispatcher.BeginInvoke(() =>
                {
                    TaskLists = tempTaskLists;

                    TodayTasks = tempTodayTasks;
                    TomorrowTasks = tempTomorrowTasks;
                    OverdueTasks = tempOverdueTasks;
                    WeekTasks = tempWeekTasks;
                    NoDueTasks = tempNoDueTasks;

                    Tags = tempTags;
                });
            }
        }
 public CJSGCfg() {
   this.Items = new SortableObservableCollection<CJSGColumnCfg>();
 }
Example #60
0
 public AddressBook()
 {
     Contacts = new SortableObservableCollection<Contact>();
 }