Exemplo n.º 1
0
        private void DbConfigDilogCloseEventHanle(object Sender, DialogClosingEventArgs args)
        {
            if ((bool)args.Parameter == false)
            {
                return;
            }
            DataBaeConfigViewModel model = ((System.Windows.FrameworkElement)args.Session.Content).DataContext as DataBaeConfigViewModel;
            SynchronousDb          db    = AutoMapper.Mapper.Map <SynchronousDb>(model);

            switch (IsModify)
            {
            case true:
                dataBaseService.Update(db);
                break;

            case false:
                dataBaseService.Add(db);
                break;

            default:
                dataBaseService.Update(db);
                break;
            }

            LoadData();//重新加载数据
        }
Exemplo n.º 2
0
        //private async void ChangeDbState(SynchronousDbViewModel model)
        //{
        //    model.Enable = model.Enable == 0 ? 1 : 0;
        //    SynchronousDb db = AutoMapper.Mapper.Map<SynchronousDb>(model);
        //    await dataBaseService.Update(db);
        //}

        private async void OpenDbConfigDilog(string opearType)
        {
            var view = new DataBaeConfigPanel();

            switch (opearType.ToLower())
            {
            case "add":
                IsModify = false;
                break;

            case "modify":
                IsModify = true;
                DataBaeConfigViewModel model = AutoMapper.Mapper.Map <DataBaeConfigViewModel>(CurrentSynchronousDB);
                view.DataContext = model;
                break;
            }
            var result = await DialogHost.Show(view, DbConfigDilogCloseEventHanle);
        }