Пример #1
0
        private void LoadBusinessObjects(ISearchQuery query)
        {
            try
            {
                var srv = new DataLoadingService {
                    Repository = Repository
                };

                srv.ProgressChanged += (sender, tuple) =>
                {
                    SetProgress(tuple);
                    if (tuple.Item3 != null)
                    {
                        BusinessObjectList.Add(tuple.Item3 as BusinessObject);
                    }
                };
                srv.Finished += (sender, isSucceed) =>
                {
                    if (!isSucceed)
                    {
                        AlertError(srv.Error);
                    }
                    ResetProgress();
                };

                BusinessObjectList.Clear();
                srv.Execute(query);
            }
            catch (Exception ex)
            {
                AlertError(ex.Message);
            }
        }
Пример #2
0
        public void AddNewProfile(IList <Profile> collection)
        {
            DataLoadingService dls = new DataLoadingService();

            collection.Add(new Profile()
            {
                ID = dls.GenerateID()
            });
            //messengerService.Send("ADD OK", "LogicResult");
        }
Пример #3
0
        public MainWindowViewModel(IProfileLogic logic)
        {
            this.logic = logic;

            ProfileCollection = new ObservableCollection <Profile>();

            DataLoadingService dls = new DataLoadingService();

            dls.FetchData().ForEach(x => this.logic.AddExistingProfile(ProfileCollection, x));

            AddCommand    = new RelayCommand(() => this.AddNew());
            RemoveCommand = new RelayCommand(() => this.Remove());
        }