示例#1
0
        public SymbolSettingsDialog()
        {
            InitializeComponent();

            PreferenceSerializer = new TanglePropertySerializer(
                Program.Preferences, ChooseName
            );

            PreferenceSerializer.Bind(() => SymbolServers.Text);
            PreferenceSerializer.Bind(() => SymbolPath.Text);

            foreach (var binding in PreferenceSerializer.Bindings)
                Defaults[binding] = binding.Value;

            Program.Scheduler.WaitFor(PreferenceSerializer.Load());
        }
示例#2
0
        public void TestSerializesProperties()
        {
            var instance = new ClassWithProperties {
                A = 1,
                B = 2,
                C = "foo"
            };

            Serializer.Bind(() => instance.A);
            Serializer.Bind(() => instance.B);
            Serializer.Bind(() => instance.C);

            Scheduler.WaitFor(Serializer.Save());

            Assert.AreEqual(1, (int)Scheduler.WaitFor(Tangle.Get("A")));
            Assert.AreEqual(2, (int)Scheduler.WaitFor(Tangle.Get("B")));
            Assert.AreEqual("foo", (string)Scheduler.WaitFor(Tangle.Get("C")));
        }
        public SymbolSettingsDialog()
        {
            InitializeComponent();

            PreferenceSerializer = new TanglePropertySerializer(
                Program.Preferences, ChooseName
                );

            PreferenceSerializer.Bind(() => SymbolServers.Text);
            PreferenceSerializer.Bind(() => SymbolPath.Text);

            foreach (var binding in PreferenceSerializer.Bindings)
            {
                Defaults[binding] = binding.Value;
            }

            Program.Scheduler.WaitFor(PreferenceSerializer.Load());
        }