コード例 #1
0
        public void then_name_contains_key_property_value()
        {
            var KeyValueElement = AppSettingsView.GetDescendentsOfType <KeyValueConfigurationElement>().First();
            var KeyProperty     = KeyValueElement.Property("Key");

            Assert.IsTrue(KeyValueElement.Name.Contains((string)KeyProperty.Value));
        }
コード例 #2
0
        public void then_can_create_new_app_setting()
        {
            var KeyValueCollection = AppSettingsView.GetDescendentsOfType <KeyValueConfigurationCollection, ElementCollectionViewModel>().First();
            var element            = KeyValueCollection.AddNewCollectionElement(typeof(KeyValueConfigurationElement));

            Assert.IsNotNull(element);
        }
コード例 #3
0
        public void then_appsetting_key_property_has_display_name_attribute()
        {
            var KeyValueElement = AppSettingsView.GetDescendentsOfType <KeyValueConfigurationElement>().First();
            var KeyProperty     = KeyValueElement.Property("Key");

            Assert.IsTrue(KeyProperty.Attributes.OfType <DisplayNameAttribute>().Any());
        }
コード例 #4
0
        public void then_key_property_is_writeable()
        {
            var KeyValueElement = AppSettingsView.GetDescendentsOfType <KeyValueConfigurationElement>().First();
            var KeyProperty     = KeyValueElement.Property("Key");

            KeyProperty.Value = "new value";
            Assert.AreEqual("new value", KeyProperty.Value);
        }
コード例 #5
0
ファイル: MainWindowViewModel.cs プロジェクト: litfung/madoka
        private void ExecuteAddCommand()
        {
            var view = new AppSettingsView()
            {
                Owner = MainWindow.Instance,
            };

            (view.DataContext as AppSettingsViewModel).Model = new ManagedWindowModel();
            (view.DataContext as AppSettingsViewModel).RefreshManagedWindowsListCallback = () => this.RefreshList();

            view.Show();
        }
コード例 #6
0
        void AppSettingsStartup(bool smth)
        {
            var ctx = new ModalDialogContext();

            AppSettingsView
            .Show(ctx)
            .Subscribe(
                result => {
                ctx.Dispose();
            },
                error => {
                ctx.Dispose();
                dbg.Error(error);
            }
                );
        }
        protected override void Act()
        {
            var collection = (ElementCollectionViewModel)base.AppSettingsView.GetDescendentsOfType <KeyValueConfigurationCollection>().FirstOrDefault();
            var newElement = collection.AddNewCollectionElement(typeof(KeyValueConfigurationElement));

            newElement.Property("Key").Value   = "new-setting";
            newElement.Property("Value").Value = "value";

            var newElement2 = collection.AddNewCollectionElement(typeof(KeyValueConfigurationElement));

            newElement2.Property("Key").Value   = "new-setting-2";
            newElement2.Property("Value").Value = "value";

            DesignDictionaryConfigurationSource saveSource = new DesignDictionaryConfigurationSource();

            AppSettingsView.Save(saveSource);
            savedSection = (AppSettingsSection)saveSource.GetSection("appSettings");
        }
コード例 #8
0
        public void ShowView(AppSettingsArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("AppSettingsArgs");
            }

            var win = new AppSettingsView()
            {
                DataContext = new AppSettingsViewModel(args.WndTitle)
                {
                    AccessToken = args.SrvSettings?.AccessToken,
                    ServiceUrl  = args.SrvSettings?.ServiceUrl,
                    VersionDate = args.SrvSettings?.VersionDate
                }
            };

            win.Closing += this.DialogClosing;
            win.Owner    = Application.Current.MainWindow;
            win.ShowDialog();
        }
コード例 #9
0
        public void then_appsetting_collection_has_display_name_attribute()
        {
            var KeyValueCollection = AppSettingsView.GetDescendentsOfType <KeyValueConfigurationCollection>().First();

            Assert.IsTrue(KeyValueCollection.Attributes.OfType <DisplayNameAttribute>().Any());
        }
コード例 #10
0
 protected override void Act()
 {
     AppSettingsView.Save(saveSource);
 }