• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ObservableDictionary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Run

 public Run()
   : base() {
   name = ItemName;
   description = ItemDescription;
   color = Color.Black;
   algorithm = null;
   parameters = new ObservableDictionary<string, IItem>();
   results = new ObservableDictionary<string, IItem>();
 }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:9,代码来源:Run.cs


示例17: Variety

 public Variety(string name)
 {
     _name = name;
     _words = new WordCollection(this);
     _varietyPairs = new VarietyVarietyPairCollection(this);
     _affixes = new BulkObservableList<Affix>();
     _regions = new BulkObservableList<GeographicRegion>();
     _syllablePositionSegmentFreqDists = new ObservableDictionary<FeatureSymbol, FrequencyDistribution<Segment>>();
 }
开发者ID:rmunn,项目名称:cog,代码行数:9,代码来源:Variety.cs


示例18: ToDictionary_Get

 public void ToDictionary_Get()
 {
     var source = new ObservableDictionary<int, string>();
     var get2 = Nothing<string>();
     source.ToLiveLinq()[2].Subscribe(val => get2 = val);
     get2.Should().Be(Nothing<string>());
     source.Add(2, "Hi there");
     get2.Should().Be(Something("Hi there"));
 }
开发者ID:ApocalypticOctopus,项目名称:Apocalyptic.Utilities.Net,代码行数:9,代码来源:DictionaryLiveLinqQueryTests.cs


示例19: Awake

    // Use this for initialization
    void Awake()
    {
        ScriptEngine = new ScriptEngine();
        ScriptEngine.SetGlobalValue("console", new JSConsole(ScriptEngine));

        BlockTypes = new ObservableDictionary<string, JSBlockType>();
        BlockTypes.OnAdded += HandleBlockTypesOnAdded;

        Map = new JSMap(ScriptEngine);
    }
开发者ID:dallonf,项目名称:WorldScript,代码行数:11,代码来源:GameContext.cs


示例20: MainPage

        public MainPage()
        {
            DefaultViewModel = new ObservableDictionary<String, Object>();

            listaAbas = new ObservableCollection<AbaDado>();

            this.InitializeComponent();

            DefaultViewModel["NavigationItemList"] = listaAbas;
        }
开发者ID:obritto,项目名称:tabAbaApp,代码行数:10,代码来源:MainPage.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ObservableDummy类代码示例发布时间:2022-05-24
下一篇:
C# ObservableCollectionEx类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap