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


C# Note.Load方法代码示例

本文整理汇总了C#中Note.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Note.Load方法的具体用法?C# Note.Load怎么用?C# Note.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Note的用法示例。


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

示例1: NoteTaker5Page

        public NoteTaker5Page()
        {
            // Create Entry and Editor views.
            Entry entry = new Entry
            {
                Placeholder = "Title (optional)"
            };

            Editor editor = new Editor
            {
                Keyboard = Keyboard.Create(KeyboardFlags.All),
                BackgroundColor = Device.OnPlatform(Color.Default, 
                                                    Color.Default, 
                                                    Color.White),
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            // Set data bindings.
            Note note = new Note();
            this.BindingContext = note;
            entry.SetBinding(Entry.TextProperty, "Title");
            editor.SetBinding(Editor.TextProperty, "Text");

            // Create Save and Load buttons.
            Button saveButton = new Button
            {
                Text = "Save",
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            Button loadButton = new Button
            {
                Text = "Load",
                IsEnabled = false,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            // Set Clicked handlers.
            saveButton.Clicked += (sender, args) =>
                {
                    note.Save(FILENAME);
                    loadButton.IsEnabled = true;
                };

            loadButton.Clicked += (sender, args) => note.Load(FILENAME);

            // Check if the file is available.
            FileHelper.Exists(FILENAME, (exists) =>
                {
                    loadButton.IsEnabled = exists;
                });

            // Assemble page.
            this.Padding =
                new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 0);

            this.Content = new StackLayout
            {
                Children = 
                {
                    new Label 
                    { 
                        Text = "Title:" 
                    },
                    entry,
                    new Label 
                    { 
                        Text = "Note:" 
                    },
                    editor,
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children = 
                        {
                            saveButton,
                            loadButton
                        }
                    }
                }
            };
        }
开发者ID:karanga,项目名称:xamarin-forms-book-preview,代码行数:82,代码来源:NoteTaker5Page.cs


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