当前位置: 首页>>代码示例>>C#>>正文


C# ObservableDictionary类代码示例

本文整理汇总了C#中ObservableDictionary的典型用法代码示例。如果您正苦于以下问题:C# ObservableDictionary类的具体用法?C# ObservableDictionary怎么用?C# ObservableDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObservableDictionary类属于命名空间,在下文中一共展示了ObservableDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GeomagicTouchViewModel

        /// <summary>
        /// Constructs a new GeomagicTouch View Model
        /// </summary>
        public GeomagicTouchViewModel()
        {
            DeviceNames = new ObservableCollection<string>();
            SignalSources = new ObservableDictionary<string, SignalSourceViewModel>();

            SignalSources.Add("X", new SignalSourceViewModel("X Position"));
            SignalSources.Add("Y", new SignalSourceViewModel("Y Position"));
            SignalSources.Add("Z", new SignalSourceViewModel("Z Position"));
            SignalSources.Add("Theta1", new SignalSourceViewModel("Gimbal Theta 1"));
            SignalSources.Add("Theta2", new SignalSourceViewModel("Gimbal Theta 2"));
            SignalSources.Add("Theta3", new SignalSourceViewModel("Gimbal Theta 3"));
            SignalSources.Add("Inkwell", new SignalSourceViewModel("Inkwell Switch"));
            SignalSources.Add("Button1", new SignalSourceViewModel("Button 1"));
            SignalSources.Add("Button2", new SignalSourceViewModel("Button 2"));
            SignalSources.Add("Button3", new SignalSourceViewModel("Button 1"));
            SignalSources.Add("Button4", new SignalSourceViewModel("Button 2"));

            TypeName = "Geomagic Touch";

            // Get a list of all GeomagicTouch device names
            foreach(string device in GetGeomagicDevices())
            {
                DeviceNames.Add(device);
            }

            UpdateTimer = new System.Timers.Timer();
            UpdateTimer.Elapsed += UpdateTimer_Elapsed;
            UpdateTimer.Interval = 50;
        }
开发者ID:surgical-robots,项目名称:robot-control-app,代码行数:32,代码来源:GeomagicTouchViewModel.cs

示例2: ShouldBindBetweenIndexedObjects

        public void ShouldBindBetweenIndexedObjects()
        {
            var binder = new Binder<ObservableDictionary<UniversalStub>>();

            var dict= new ObservableDictionary<UniversalStub>();

            binder.BindIf(x => x.ContainsKey("first") && x.ContainsKey("second"), x => x["first"].String).To(x => x["second"].String);

            using (binder.Attach(dict))
            {
                var first = new UniversalStub();
                var second = new UniversalStub { String = "a" };
                dict.Add("second", second);
                second.String.ShouldBe("a");
                using (second.VerifyChangedOnce("String"))
                {
                    dict.Add("first", first);
                }
                second.String.ShouldBe(null);

                using (second.VerifyChangedOnce("String"))
                {
                    first.String = "b";
                }
                second.String.ShouldBe("b");
            }
        }
开发者ID:Chrisophylacks,项目名称:PropertyBinder,代码行数:27,代码来源:IndexerBindingsFixture.cs

示例3: BlockTypes_OnAdded

 private void BlockTypes_OnAdded(object sender, ObservableDictionary<string, JSBlockType>.DictionaryEventArgs e)
 {
     var material = new Material(BaseBlockMaterial);
     material.color = GetColor(e.Value);
     blockMaterials.Add(e.Key, material);
     e.Value.ColorChanged += BlockType_ColorChanged;
 }
开发者ID:dallonf,项目名称:WorldScript,代码行数:7,代码来源:MapController.cs

示例4: MainViewModel

        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            instance = this; // this sets the static Instance property to this instance.

            Plugins = new ObservableCollection<PluginBase>();

            Devices = new ObservableCollection<Device>();

            Motors = new ObservableCollection<MotorViewModel>();

            Plugins.CollectionChanged += Plugins_CollectionChanged;

            Controllers = new ObservableCollection<ControllerViewModel>();

            Controllers.CollectionChanged += Controllers_CollectionChanged;

            Robot = new Robot();

            // This lets us know what's going on with the Robot's internal Joint collection.
            Robot.Controllers.CollectionChanged += RobotControllers_CollectionChanged;

            //InputSignalRegistry = new ViewModel.SignalSinkRegistryViewModel();
            InputSignalRegistry = new ObservableDictionary<string, string>();

            Messenger.Default.Register<Messages.RemoveController>(this,
               (message) =>
               {
                   Controllers.Remove(message.ControllerToRemove);
                   com = this.Robot.Com;
               }
            );
        }
开发者ID:surgical-robots,项目名称:robot-control-app,代码行数:35,代码来源:MainViewModel.cs

示例5: OnStartup

        protected override void OnStartup( StartupEventArgs e )
        {
            base.OnStartup( e );

            mMainWindow = new MainWindow();

            var windowDescriptions = new ObservableDictionary<string, D3D11HwndDescription>
                                     {
                                         {
                                             "TileManager2D",
                                             new D3D11HwndDescription
                                             {
                                                 Handle = mMainWindow.TileManager2DViewerContext.D3D11RenderingPaneHost.Handle,
                                                 Width = mMainWindow.TileManager2DViewerContext.D3D11RenderingPaneHost.Width,
                                                 Height = mMainWindow.TileManager2DViewerContext.D3D11RenderingPaneHost.Height
                                             }
                                             },
                                     };

            mEngine = new Engine( windowDescriptions );

            mUpdateTimer = new DispatcherTimer( DispatcherPriority.Input ) { Interval = TimeSpan.FromMilliseconds( Settings.Default.TargetFrameTimeMilliseconds ) };
            mUpdateTimer.Tick += TickHandler;
            mUpdateTimer.Start();

            var engineDataContext = new EngineDataContext( mEngine, new TileManagerDataContext( mEngine.TileManager ) );

            mMainWindow.DataContext = engineDataContext;

            mMainWindow.Closing += OnMainWindowClosing;

            mMainWindow.Show();
        }
开发者ID:Rhoana,项目名称:Mojo,代码行数:33,代码来源:Application.xaml.cs

示例6: SwaggerService

        /// <summary>Initializes a new instance of the <see cref="SwaggerService"/> class.</summary>
        public SwaggerService()
        {
            Swagger = "2.0";
            Schemes = new List<SwaggerSchema>();
            Responses = new Dictionary<string, SwaggerResponse>();
            SecurityDefinitions = new Dictionary<string, SwaggerSecurityScheme>();

            Info = new SwaggerInfo
            {
                Version = string.Empty,
                Title = string.Empty
            };

            Definitions = new ObservableDictionary<string, JsonSchema4>();
            Definitions.CollectionChanged += (sender, args) =>
            {
                foreach (var pair in Definitions.Where(p => string.IsNullOrEmpty(p.Value.TypeName)))
                    pair.Value.TypeName = pair.Key;
            };

            Paths = new ObservableDictionary<string, SwaggerOperations>();
            Paths.CollectionChanged += (sender, args) =>
            {
                foreach (var path in Paths.Values)
                    path.Parent = this;
            };
        }
开发者ID:geffzhang,项目名称:NSwag,代码行数:28,代码来源:SwaggerService.cs

示例7: InitDisplayResources

        /// <summary>
        /// Get display resource for current project.
        /// </summary>
        /// <returns>Resource of project as a dictionary.</returns>
        public static void InitDisplayResources()
        {
            var culture = GetCurrentCulture();

            if (Resource != null)
            {
                return;
            }

            Resource = new ObservableDictionary<string, string>();
            try
            {
                var resourceStringMap = ResourceManager.Current.MainResourceMap.GetSubtree("Resources");
                foreach (var key in resourceStringMap.Keys)
                {
                    // get resources base on context language
                    Resource[key] = resourceStringMap.GetValue(key, culture).ValueAsString;
                }
            }
            catch (Exception exception)
            {
                LogManager.Instance.LogException(exception.ToString());
            }


            Resource["DOW_1"] = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[0];
            Resource["DOW_2"] = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[1];
            Resource["DOW_3"] = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[2];
            Resource["DOW_4"] = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[3];
            Resource["DOW_5"] = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[4];
            Resource["DOW_6"] = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[5];
            Resource["DOW_7"] = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[6];
        }
开发者ID:nghia2080,项目名称:CProject,代码行数:37,代码来源:LanguageProvider.cs

示例8: AddItem

 public void AddItem()
 {
   _handle = new EventWaitHandle(false, EventResetMode.ManualReset);
   var test = new ObservableDictionary<int, string>();
   test.ItemAdded += Dictionary_ItemEvent;
   test.Add(0, "myValue");
   Assert.IsTrue(_handle.WaitOne(10));
 }
开发者ID:rnpowerconsulting,项目名称:appstract,代码行数:8,代码来源:ObservableDictionaryTests.cs

示例9: ObservableDictionaryExtensions_Any_ReturnsFalseIfObservableDictionaryDoesNotContainItems

        public void ObservableDictionaryExtensions_Any_ReturnsFalseIfObservableDictionaryDoesNotContainItems()
        {
            var dictionary = new ObservableDictionary<Int32, String>();

            var result = dictionary.Any();

            TheResultingValue(result).ShouldBe(false);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:8,代码来源:ObservableDictionaryExtensionsTest.cs

示例10: CustomNodeLoader

        /// <summary>
        ///     Class Constructor
        /// </summary>
        /// <param name="searchPath">The path to search for definitions</param>
        public CustomNodeLoader(string searchPath)
        {
            SearchPath = new ObservableCollection<string>();
            SearchPath.Add(searchPath);

            NodeNames = new ObservableDictionary<string, Guid>();
            NodeCategories = new ObservableDictionary<Guid, string>();
        }
开发者ID:kyoisi,项目名称:Dynamo,代码行数:12,代码来源:CustomNodeLoader.cs

示例11: Project

 public Project()
 {
     LastAssignedUniqueID = 0;
     _lastPageNumber = 0;
     PageDictionary = new ObservableDictionary<long, ASGPage>();
     ProjectName = "Untitled Project";
     DefaultCanvasSettings = new CanvasSettings();
 }
开发者ID:tuliosouza,项目名称:ASG,代码行数:8,代码来源:Project.cs

示例12: PlayerShip

 public PlayerShip()
 {
     MaxHull = Hull = 30;
     Scrap = 0;
     Items = new ObservableDictionary<string, int>();
     Items.CollectionChanged += (sender, e) =>
         DoShipModified(new ShipModifiedEventArgs("Items", e));
 }
开发者ID:DiEvAl,项目名称:ftl-overdrive,代码行数:8,代码来源:PlayerShip.cs

示例13: ObservableDictionaryExtensions_All_ReturnsTrueIfObservableDictionaryIsEmpty

        public void ObservableDictionaryExtensions_All_ReturnsTrueIfObservableDictionaryIsEmpty()
        {
            var dictionary = new ObservableDictionary<Int32, String>();

            var result = dictionary.All(x => x.Key % 2 == 0);

            TheResultingValue(result).ShouldBe(true);
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:8,代码来源:ObservableDictionaryExtensionsTest.cs

示例14: IOSpec

 /// <summary>
 /// Initializes a new s_instance of the <see cref="IOSpec"/> class.
 /// </summary>
 internal IOSpec() 
 { 
     m_input = new ObservableDictionary<string, IOItem>();
     m_output = new ObservableDictionary<string, IOItem>();
     ((INotifyCollectionChanged)m_input).CollectionChanged += new NotifyCollectionChangedEventHandler(IOSpec_CollectionChanged);
     ((INotifyCollectionChanged)m_output).CollectionChanged += new NotifyCollectionChangedEventHandler(IOSpec_CollectionChanged);
     
 }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:11,代码来源:IOSpec.cs

示例15: DisplayAllView

 public DisplayAllView()
 {
     this.InitializeComponent();
     EntryRepository = new EntryRepository();
     NavigationHelper = new NavigationHelper(this);
     DefaultViewModel = new ObservableDictionary();
     NavigationHelper.LoadState += NavigationHelper_LoadState;
     NavigationHelper.SaveState += NavigationHelper_SaveState;
 }
开发者ID:bniculea,项目名称:passwordKeeperW10,代码行数:9,代码来源:DisplayAllView.xaml.cs


注:本文中的ObservableDictionary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。