Exemple #1
0
 public override void TearDown()
 {
     obj = null;
     ilvm = null;
     ctx = null;
     base.TearDown();
 }
Exemple #2
0
 public override void SetUp()
 {
     base.SetUp();
     ctx = scope.Resolve<IZetboxContext>();
     ilvm = vmf.CreateViewModel<InstanceListViewModel.Factory>().Invoke(ctx, null, (ObjectClass)NamedObjects.Base.Classes.Zetbox.App.Test.One_to_N_relations_N.Find(ctx), null);
     obj = ctx.Create<One_to_N_relations_N>();
     ctx.SubmitChanges();
 }
 public SavedListConfiguratorViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, InstanceListViewModel parent)
     : base(appCtx, dataCtx, parent)
 {
 }
        private void EnsureListViewModel()
        {
            if (_listViewModel == null)
            {
                if (Type == null) throw new InvalidOperationException("Type is not set yet!");

                _listViewModel = ViewModelFactory
                    .CreateViewModel<InstanceListViewModel.Factory>()
                    .Invoke(DataContext, this, _ctxFactory, Type, QueryFactory);

                InitializeListViewModel(_listViewModel);
            }
        }
        protected virtual void InitializeListViewModel(InstanceListViewModel mdl)
        {
            var screen = this.Screen;

            if (screen.AllowAddNew.HasValue) mdl.AllowAddNew = screen.AllowAddNew.Value;
            if (screen.AllowDelete.HasValue) mdl.AllowDelete = screen.AllowDelete.Value;
            if (screen.AllowSelectColumns.HasValue) mdl.AllowSelectColumns = screen.AllowSelectColumns.Value;
            if (screen.AllowUserFilter.HasValue) mdl.AllowUserFilter = screen.AllowUserFilter.Value;
            if (screen.EnableAutoFilter.HasValue) mdl.EnableAutoFilter = screen.EnableAutoFilter.Value;
            if (screen.IsEditable.HasValue) mdl.IsEditable = screen.IsEditable.Value;
            if (screen.IsMultiselect.HasValue) mdl.IsMultiselect = screen.IsMultiselect.Value;
            if (screen.RespectRequiredFilter.HasValue) mdl.RespectRequiredFilter = screen.RespectRequiredFilter.Value;
            if (screen.ShowFilter.HasValue) mdl.ShowFilter = screen.ShowFilter.Value;
            if (screen.ShowMasterDetail.HasValue) mdl.ShowMasterDetail = screen.ShowMasterDetail.Value;
            if (screen.ShowOpenCommand.HasValue) mdl.ShowOpenCommand = screen.ShowOpenCommand.Value;
            if (screen.ShowRefreshCommand.HasValue) mdl.ShowRefreshCommand = screen.ShowRefreshCommand.Value;

            if (!string.IsNullOrEmpty(screen.InitialSort))
            {
                if (screen.InitialSortDirection.HasValue)
                {
                    mdl.SetInitialSort(screen.InitialSort, (System.ComponentModel.ListSortDirection)screen.InitialSortDirection.Value);
                }
                else
                {
                    mdl.SetInitialSort(screen.InitialSort);
                }
            }

            if (screen.RequestedWorkspaceKind != null) mdl.RequestedWorkspaceKind = screen.RequestedWorkspaceKind;
            if (screen.RequestedEditorKind != null) mdl.RequestedEditorKind = screen.RequestedEditorKind;
            if (screen.ViewMethod.HasValue) mdl.ViewMethod = screen.ViewMethod.Value;
        }
 void ListViewModel_ItemsDefaultAction(InstanceListViewModel sender, IEnumerable<DataObjectViewModel> objects)
 {
     if (objects != null && objects.Count() > 0) Choose(objects);
 }
Exemple #7
0
 private void SyncInstances(InstanceListViewModel ocModel)
 {
     System.Diagnostics.Debug.WriteLine("SyncModules");
     _instancesList.BeginUpdate();
     try
     {
         _instancesList.Items.Clear();
         foreach (var dom in ocModel.Instances)
         {
             var lvi = new ListViewItem(dom.Name) { Tag = dom };
             dom.PropertyChanged += new PropertyChangedEventHandler(InstancePropertyChanged);
             _instancesList.Items.Add(lvi);
         }
     }
     finally
     {
         _instancesList.EndUpdate();
     }
 }
Exemple #8
0
 private static void SetupViewModel(InstanceListViewModel lstMdl)
 {
     lstMdl.BeginInit();
     lstMdl.AllowAddNew = true;
     lstMdl.AllowDelete = true;
     lstMdl.ViewMethod = InstanceListViewMethod.Details;
     var toRemove = lstMdl.Filter.SingleOrDefault(f => f.ValueSource != null && f.ValueSource.LastInnerExpression == "Module");
     if (toRemove != null)
         lstMdl.FilterList.RemoveFilter(toRemove);
     lstMdl.EndInit();
 }
 private static void SetupViewModel(InstanceListViewModel lstMdl)
 {
     lstMdl.AllowAddNew = true;
     lstMdl.AllowDelete = true;
 }
 public SavedListConfiguratorViewModel(IViewModelDependencies appCtx, Func<IZetboxContext> ctxFactory, IZetboxContext dataCtx, InstanceListViewModel parent)
     : base(appCtx, dataCtx, parent)
 {
     this.ctxFactory = ctxFactory;
 }