Esempio n. 1
0
        /// <summary>
        /// Called when creating the window.
        /// </summary>
        /// <param name="viewModel">The primary view model of the program</param>
        /// <param name="loggerFactory">DI for the local logger.</param>
        public ReorderTasksWindow(ViewModel viewModel, ILogger <ReorderTasksWindow> logger)
        {
            // Save dependencies
            mainViewModel  = viewModel;
            taskCollection = viewModel.TaskList;
            this.logger    = logger;

            // Set up commands
            MoveUpCommand       = new RelayCommand(this, nameof(MoveUpCommand), MoveTaskUp, CanMoveTaskUp);
            MoveDownCommand     = new RelayCommand(this, nameof(MoveDownCommand), MoveTaskDown, CanMoveTaskDown);
            SortAlphaCommand    = new RelayCommand(this, nameof(SortAlphaCommand), SortTasksAlpha, CanSortTasks);
            SortOriginalCommand = new RelayCommand(this, nameof(SortOriginalCommand), SortTasksOriginal, CanSortTasks);

            // Create view of the task collection for display in the window.
            TaskView = new ListCollectionView(taskCollection);

            // Set the data context for the XAML frontend.
            DataContext = this;

            // Initialize the window components
            InitializeComponent();

            // Add event watchers
            viewModel.PropertyChanged        += MainViewModel_PropertyChanged;
            taskCollection.CollectionChanged += TaskList_CollectionChanged;
            TaskView.CurrentChanged          += TaskView_CurrentChanged;
        }
        private ObservableCollectionExt <Enseignant> GetEnseignantsAttribues(Enseignement enseignementSelectionne)
        {
            ObservableCollectionExt <Enseignant> Enseignants = new ObservableCollectionExt <Enseignant>();

            foreach (EC ec in EC.findAll())
            {
                if (enseignementSelectionne.Id == ec.Enseignement.Id)
                {
                    foreach (InfosAssignation ia in InfosAssignation.findAll())
                    {
                        if (ec.Id == ia.EC.Id)
                        {
                            foreach (Enseignant enseignant in enseignant.findAll())
                            {
                                if (!(ia.Enseignant is null) && ia.Enseignant.Id == enseignant.Id && !Enseignants.Any(a => a.Id == enseignant.Id))
                                {
                                    Enseignants.Add(new Enseignant {
                                        Id = enseignant.Id, Nom = enseignant.Nom, Prenom = enseignant.Prenom, nbHeuresTravaillees = enseignant.nbHeuresTravaillees, Categorie = enseignant.Categorie
                                    });
                                }
                            }
                        }
                    }
                }
            }
            return(Enseignants);
        }
Esempio n. 3
0
 private void AddCharset(ref ObservableCollectionExt <CharExt> charactersToUse, char [] charset)
 {
     foreach (char ch in charset)
     {
         charactersToUse.Add(new CharExt(ch));
     }
 }
Esempio n. 4
0
        public CdReaderViewModel(ICdReaderService cdReaderService,
                                 IDialogService dialogService)
        {
            _targetDirectory = string.Empty;
            _driveLetter     = string.Empty;
            _cdReaderService = cdReaderService;
            _dialogService   = dialogService;

            var drives = DriveInfo.GetDrives()
                         .Where(drive => drive.DriveType == DriveType.CDRom)
                         .Select(drive => drive.Name);

            CdRomDrives = new ObservableCollectionExt <string>(drives);

            if (CdRomDrives.Count > 0)
            {
                DriveLetter = CdRomDrives[0];
            }

            CdItems              = new BindingList <CdItemViewModel>();
            CdItems.ListChanged += OnCdItemsChanged;

            OpenDriveCommand    = new MvxCommand(OnOpenDrive, CanDoAction);
            SelectOutDirCommand = new MvxCommand(OnSelectOutDir, CanDoAction);
            ReadCommand         = new MvxCommand(OnRead, CanRead);
            CancelCommand       = new MvxCommand(OnCancel);
            SelectAllCommand    = new MvxCommand(() => SetSelectionState(true), CanSelect);
            DeSelectAllCommand  = new MvxCommand(() => SetSelectionState(false), CanSelect);

            _cts = new CancellationTokenSource();
            _progressReporter = new Progress <long>();
            _progressReporter.ProgressChanged += OnReportProgress;
        }
 private void CreatedMenu()
 {
     ItemsMenu = new ObservableCollectionExt <Menu>()
     {
         new Menu {
             Page = "Home", Title = "Rederers Base", Icon = "Gamepad", PopupPage = true
         },
         new Menu {
             Page = "HomeBottomBar", Title = "Home Bottom Bar", Icon = "Ticket"
         },
         new Menu {
             Page = "Home", Title = "Tablero de Continuidad", Icon = "UserCircle"
         },
         new Menu {
             Page = "TiempoReal", Title = "Tablero de Tiempo Real", Icon = "Bell"
         },
         new Menu {
             Page = "Historicos", Title = "Tablero Histórico", Icon = "Plus"
         },
         new Menu {
             Page = "Home", Title = "Analiticos Gráficas", Icon = "PowerOff"
         },
         new Menu {
             Page = "Home", Title = "Tableros Dinámicos", Icon = "Minus"
         }
     };
 }
Esempio n. 6
0
 public HomeBottomBarPageViewModel(INavigationService navigationService, IUserDialogs userDialogsService, IConnectivity connectivity) : base(navigationService, userDialogsService, connectivity)
 {
     TitleToolbar = "Home Bottom Bar";
     Items        = new ObservableCollectionExt <BottomBarItem>
     {
         new BottomBarItem {
             Position = 0, Icon = "Gamepad", Page = new ContentView {
                 BackgroundColor = Color.Red
             },
             Title = "Test1"
         },
         new BottomBarItem {
             Position = 1, Icon = "Gamepad",
             Page     = new ContentView {
                 BackgroundColor = Color.Black
             }, Title = "Test1"
         },
         new BottomBarItem {
             Position = 2, Icon = "Gamepad", Page = new ContentView {
                 BackgroundColor = Color.BlueViolet
             }, Title = "Test1"
         },
         new BottomBarItem {
             Position = 3, Icon = "Gamepad", Page = new ContentView {
                 BackgroundColor = Color.Accent
             }, Title = "Test1"
         }
     };
 }
        public void ReplaceTest()
        {
            ObservableCollectionExt <TestClass> collection = new ObservableCollectionExt <TestClass>();

            var obj1 = new TestClass {
                Id = 1, Value = "one"
            };
            var obj2 = new TestClass {
                Id = 2, Value = "two"
            };
            var obj3 = new TestClass {
                Id = 3, Value = "three"
            };
            var obj4 = new TestClass {
                Id = 4, Value = "four"
            };

            collection.Add(obj1);
            collection.Add(obj2);
            collection.Add(obj3);

            collection.Replace(obj2, obj4);

            Assert.AreEqual(3, collection.Count);
            Assert.AreEqual(1, collection[0].Id);
            Assert.AreEqual(4, collection[1].Id);
            Assert.AreEqual("four", collection[1].Value);
            Assert.AreEqual(3, collection[2].Id);
        }
Esempio n. 8
0
 public void SetUp()
 {
     _applicationSettings = new Mock <IApplicationSettings>();
     _viewModel           = new Mock <IMainWindowViewModel>();
     _keyBindings         = new ObservableCollectionExt <KeyBindingCommand>();
     _viewModel.Setup(x => x.KeyBindings).Returns(_keyBindings);
 }
        public void RemoveRangeTest()
        {
            ObservableCollectionExt <TestClass> collection = new ObservableCollectionExt <TestClass>();

            var obj1 = new TestClass {
                Id = 1, Value = "one"
            };
            var obj2 = new TestClass {
                Id = 2, Value = "two"
            };
            var obj3 = new TestClass {
                Id = 3, Value = "three"
            };
            var obj4 = new TestClass {
                Id = 4, Value = "four"
            };

            collection.AddRange(new List <TestClass> {
                obj1, obj2, obj3, obj4
            });

            int counter = 0;

            collection.CollectionChanged += (s, e) => counter++;

            collection.RemoveItems(new List <TestClass> {
                obj2, obj4
            });

            Assert.AreEqual(1, counter);
            Assert.AreEqual(2, collection.Count);
            Assert.AreEqual(1, collection[0].Id);
            Assert.AreEqual(3, collection[1].Id);
        }
Esempio n. 10
0
        public MainViewModel(QuestCollectionWrapper config, HttpClientHandler handler,
                             IPageProvider pageProvider, ITextResultsProvider textResults,
                             IErrorLogger errorLogger, Func <string, CompareInfo, CompareOptions, int> hashFunction)
        {
            ErrorLog.LogUsing(errorLogger);
            Agnostic.HashStringsUsing(hashFunction);

            if (config != null)
            {
                QuestList = config.QuestCollection;
                QuestList.Sort();
                SelectQuest(config.CurrentQuest);
            }
            else
            {
                QuestList = new QuestCollection();
                SelectQuest(null);
            }

            SetupNetwork(pageProvider, handler);
            SetupTextResults(textResults);

            AllVotesCollection  = new ObservableCollectionExt <string>();
            AllVotersCollection = new ObservableCollectionExt <string>();

            BuildCheckForNewRelease();
            BuildTally();
            BindVoteCounter();

            SetupCommands();
        }
        private ObservableCollectionExt <EC> GetECs(Enseignement enseignementSelectionne)
        {
            ObservableCollectionExt <EC> ECs = new ObservableCollectionExt <EC>();

            foreach (EC ec in EC.findAll())
            {
                if (enseignementSelectionne.Id == ec.Enseignement.Id)
                {
                    EC nouveauEC = new EC {
                        Id = ec.Id, Nom = ec.Nom.TrimEnd(), Enseignement = ec.Enseignement, Children = new ObservableCollectionExt <ObjetBase>(), Visibility = true
                    };
                    ECs.Add(nouveauEC);
                    foreach (InfosAssignation ia in InfosAssignation.findAll())
                    {
                        if (ec.Id == ia.EC.Id)
                        {
                            Enseignant enseignant = null;
                            if (!(ia.Enseignant is null))
                            {
                                enseignant = enseignementSelect.ListView.Where(x => x.Id == ia.Enseignant.Id).FirstOrDefault();
                            }


                            nouveauEC.Children.Add(new InfosAssignation {
                                Id = ia.Id, Nom = ia.Nom.TrimEnd(), EC = ia.EC, Enseignant = enseignant, TypeCours = ia.TypeCours, NbHeures = ia.NbHeures, Children = tCs, Enseignants = enseignementSelect.ListView, Parent = nouveauEC
                            });
                        }
                    }
                }
            }
            return(ECs);
        }
Esempio n. 12
0
 public BruteForcePreviewViewModel(Window bruteForcePreviewView,
                                   ObservableCollection <IteratorCounter> iteratorCounters,
                                   ObservableCollectionExt <CharExt> charList)
 {
     BruteForcePreviewView = bruteForcePreviewView;
     RequestedIterations   = iteratorCounters;
     CharList = charList;
 }
 public AddRegexViewModel(Window addRegexView)
 {
     AddRegexView = addRegexView;
     RegEx        = new RegularExpression();
     RegExMatches = new ObservableCollectionExt <string>();
     InitializeBackgroundWorkers();
     InitializeCommands();
 }
Esempio n. 14
0
 public ReportListViewModel(INavigationService navigationService,
                            ISettingsService settingsService,
                            IHudService hudService,
                            ISadmApiService apiService) :
     base(navigationService, settingsService, hudService, apiService)
 {
     ReportList = new ObservableCollectionExt <Report>();
 }
Esempio n. 15
0
 public PresetSelectorViewModel(SessionViewModel session,
                                IPresetReaderService presetReaderService,
                                IPresetRenderService presetRenderService)
 {
     _session             = session;
     _presetRenderService = presetRenderService;
     Presets   = new ObservableCollectionExt <Preset>(presetReaderService.GetPresets());
     _selected = Presets[0];
     _session.CurrentPreset = Presets[0];
 }
Esempio n. 16
0
        //HOPE WPF HANDLE PERFOMANCE WELL
        public void Refresh(string propertyName, ObservableCollectionExt <SnipePokemonViewModel> list)
        {
            list.RemoveAll(x => x.RemainTimes < 0);

            foreach (var item in list)
            {
                item.RaisePropertyChanged("RemainTimes");
            }
            RaisePropertyChanged(propertyName);
        }
Esempio n. 17
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            enseignementSelect            = (Enseignement)e.Parameter;
            enseignementSelect.Visibility = true;
            ECs = GetECs(enseignementSelect);
            enseignantsAttribues = GetEnseignantsAttribues(enseignementSelect);


            base.OnNavigatedTo(e);;
        }
Esempio n. 18
0
        public MainPage()
        {
            this.InitializeComponent();
            departements = GetDepartements();
            enseignants  = GetEnseignants();


            var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;
            Window.Current.SetTitleBar(AppTitleBar);
        }
Esempio n. 19
0
        private ObservableCollectionExt <Departement> GetDepartements()
        {
            ObservableCollectionExt <Departement> departements = new ObservableCollectionExt <Departement>();

            foreach (Departement dpt in depart.findAll())
            {
                departements.Add(new Departement {
                    Visibility = true, Id = dpt.Id, Nom = dpt.Nom.TrimEnd()
                });
            }
            return(departements);
        }
Esempio n. 20
0
        private ObservableCollectionExt <Categorie> GetCategories()
        {
            ObservableCollectionExt <Categorie> categories = new ObservableCollectionExt <Categorie>();

            foreach (Categorie categorie in categ.findAll())
            {
                categories.Add(new Categorie {
                    Id = categorie.Id, Nom = categorie.Nom.TrimEnd(), Heures = categorie.Heures
                });
            }
            return(categories);
        }
Esempio n. 21
0
        private ObservableCollectionExt <Enseignant> GetEnseignants()
        {
            ObservableCollectionExt <Enseignant> enseignants = new ObservableCollectionExt <Enseignant>();

            foreach (Enseignant ens in enseignant.findAll())
            {
                enseignants.Add(new Enseignant {
                    Id = ens.Id, Categorie = ens.Categorie, Prenom = ens.Prenom.TrimEnd(), Nom = ens.Nom.TrimEnd(), NavigationDestination = typeof(EnseignantVue), TreeView = annees
                });
            }
            return(enseignants);
        }
        private ObservableCollectionExt <ObjetBase> GetEnseignants()
        {
            ObservableCollectionExt <ObjetBase> Enseignants = new ObservableCollectionExt <ObjetBase>();

            foreach (Enseignant enseignant in enseignant.findAll())
            {
                Enseignants.Add(new Enseignant {
                    Id = enseignant.Id, Nom = enseignant.Nom.TrimEnd(), Prenom = enseignant.Prenom.TrimEnd(), nbHeuresTravaillees = enseignant.nbHeuresTravaillees, Categorie = enseignant.Categorie
                });
            }
            return(Enseignants);
        }
Esempio n. 23
0
        private ObservableCollectionExt <TypeCours> GetTypeCours()
        {
            ObservableCollectionExt <TypeCours> tCs = new ObservableCollectionExt <TypeCours>();

            foreach (TypeCours tC in tps.findAll())
            {
                tCs.Add(new TypeCours {
                    Id = tC.Id, Nom = tC.Nom.TrimEnd(), Groupes = tC.Groupes
                });
            }
            return(tCs);
        }
Esempio n. 24
0
        private int GetNrOfPossibleIterations(ref ulong nrOfPossibleIterations,
                                              ObservableCollectionExt <CharExt> charactersToUse,
                                              int passwordLength)
        {
            int result = Constants.Failure;

            try
            {
                nrOfPossibleIterations =
                    (ulong)Math.Pow((double)charactersToUse.Count, (double)passwordLength);
                result = nrOfPossibleIterations > 0 ? Constants.Success : Constants.Failure;
            }
            catch (OverflowException) {}
            return(result);
        }
        private ObservableCollectionExt <ObjetBase> GetTypeCours()
        {
            ObservableCollectionExt <ObjetBase> tCs = new ObservableCollectionExt <ObjetBase>();

            foreach (TypeCours tC in TypeCours.findAll())
            {
                tCs.Add(new TypeCours {
                    Id = tC.Id, Nom = tC.Nom.TrimEnd(), Groupes = tC.Groupes
                });
            }
            tCs.Add(new TypeCours {
                Nom = "Créer un type de cours...", Groupes = 1
            });
            return(tCs);
        }
Esempio n. 26
0
        public SnipeListViewModel()
        {
            ManualSnipe = new AddManualSnipeCoordViewModel()
            {
                Latitude = 123
            };
            this.RareList          = new ObservableCollectionExt <SnipePokemonViewModel>();
            this.OtherList         = new ObservableCollectionExt <SnipePokemonViewModel>();
            this.SnipeQueueItems   = new ObservableCollectionExt <SnipePokemonViewModel>();
            this.PokedexSnipeItems = new ObservableCollectionExt <SnipePokemonViewModel>();
            this.IV100List         = new ObservableCollectionExt <Model.SnipePokemonViewModel>();

#pragma warning disable 4014 // added to get rid of compiler warning. Remove this if async code is used below.
            //RefreshList();
#pragma warning restore 4014
        }
 public FileSelectorViewModel(SessionViewModel session, IDialogService dialogService, IFileInfoService infoService)
 {
     _session                 = session;
     _dialogService           = dialogService;
     _infoService             = infoService;
     Files                    = new ObservableCollectionExt <FileSelectorItemViewModel>();
     Files.CollectionChanged += UpdateSession;
     AddFilesCommand          = new MvxCommand(OnAddFiles);
     ClearListCommand         = new MvxCommand(OnClearList);
     RemoveSelectedCommand    = new MvxCommand <FileSelectorItemViewModel>(OnRemoveSelected, CanRemoveSelected);
     FilesDragedinCommand     = new MvxCommand <string[]>(OnFilesDraggedIn);
     AddFolderCommand         = new MvxCommand(OnAddFolder);
     SortCommand              = new MvxCommand <int>(OnSort);
     InfoSelectedCommand      = new MvxCommand <FileSelectorItemViewModel>(OnInfo, CanGetInfo);
     AddArguments(Environment.GetCommandLineArgs());
 }
Esempio n. 28
0
        private ObservableCollectionExt <EquivalentTD> GetEquivalentTDs(Categorie categorieSelectionnee)
        {
            ObservableCollectionExt <EquivalentTD> equivalentTDs = new ObservableCollectionExt <EquivalentTD>();

            foreach (EquivalentTD eqTD in equivalentTD.findAll())

            {
                if (eqTD.Categorie.Id == categorieSelectionnee.Id)
                {
                    EquivalentTD equivalent = new EquivalentTD {
                        Id = eqTD.Id, Categorie = categorieSelectionnee, TypeCours = eqTD.TypeCours, tCs = tCs, Nom = "", Ratio = eqTD.Ratio
                    };
                    equivalentTDs.Add(equivalent);
                }
            }
            return(equivalentTDs);
        }
Esempio n. 29
0
        public EditMenuViewModel(ICommand goToLineCommand,
                                 ICommand goToDataSource,
                                 ICommand goToPreviousDataSource,
                                 ICommand goToNextDataSource,
                                 ILogViewMainPanelViewModel mainPanel)
        {
            _goToLineCommand        = goToLineCommand;
            _goToDataSource         = goToDataSource;
            _goToPreviousDataSource = goToPreviousDataSource;
            _goToNextDataSource     = goToNextDataSource;
            _mainPanel = mainPanel;
            _goToItems = new ObservableCollectionExt <IMenuViewModel>();

            AllItems.Add(_goToItems);
            _dataSourceInsertionIndex = AllItems.ChildCollectionCount;
            _minCount = AllItems.ChildCollectionCount;
        }
Esempio n. 30
0
    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        ObservableCollectionExt result = new ObservableCollectionExt();
        string type = null;
        int    i;

        while (reader.Read())
        {
            if (reader.TokenType == JsonToken.PropertyName)
            {
                type = reader.Value.ToString();
            }
            else if (reader.TokenType == JsonToken.EndObject)
            {
                return(result);
            }
            else if (!string.IsNullOrEmpty(type) && reader.Value != null)
            {
                switch (type)
                {
                case "mydata1":
                {
                    result.MyData1 = reader.Value.ToString();
                    break;
                }

                case "mydata2":
                {
                    result.MyData2 = reader.Value.ToString();
                    break;
                }

                case "elements":
                {
                    if (int.TryParse(reader.Value.ToString(), out i))
                    {
                        result.Add(i);
                    }
                    break;
                }
                }
            }
        }
        return(result);
    }
 public SerachUserControl()
 {
     InitializeComponent();
     _filteredList = new ObservableCollectionExt<string>();
     DataContext = this;
 }