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


C# Category.Load方法代码示例

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


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

示例1: MainForm

        public MainForm()
        {
            InitializeComponent();

            try {
                config = XMLSerializer.Deserialize<Config>(Config.SettingPath, new Config());
            }
            catch (Exception) {
                //throw;
                config = null;
            }
            if (config == null) {
                config = new Config();
            }

            config.htmlPath = Path.GetFullPath(@"..\..\html\wiki_parser.html");
            config.ScriptDirPath = Path.GetFullPath(@"..\..\scripts");
            config.MigemoDictPath = Path.GetFullPath(@"..\..\migemo\dict\migemo-dict");
            config.DataDirPath = Path.GetFullPath(@".\data");
            config.SnippetListPath = Path.GetFullPath(@".\SnippetList.xml");
            config.LoadSnippetList();
            this.WindowState = config.WindowState;
            if (config.WindowState != FormWindowState.Maximized) {
                this.Size = config.WindowSize;
            }
            this.Location = config.WindowPos;
            splitContainer1.SplitterDistance = config.CategoryListViewW;
            ViewEditorSplitContainer.SplitterDistance = config.BrowserH;
            ListViewSplitContainer.Orientation = config.TabListView_BrowserOri;
            ListViewSplitContainer.SplitterDistance = config.ListViewSize;

            externalEditor = new ExternalEditor(Path.GetFullPath(@"."));
            externalEditor.UpDateEvent += (s, e) => {

                //var te= this.Invoke(new TextDelegate(ReadText), e.ID.ToString()+ ".txt");
                this.Invoke(new FocusDelegate(category.UpDateText), e.ID, e.Text);
                //category.UpDateText(e.ID, e.Text);

                //var i = category.GetItem(e.ID);
                //i.Text = e.Text;
                //this.Invoke(new FocusDelegate(this.editContent), i);
                //this.Invoke(InvokeScript);
            };

            initKeyMap();
            initEditor();
            initSearch();
            initBrowser();

            sm.init();
            sm.ScriptDir = config.ScriptDirPath;

            reqparam.Add("method", string.Empty);
            reqparam.Add("url", string.Empty);
            reqparam.Add("id", string.Empty);
            reqparam.Add("data", string.Empty);

            httpServer = new HttpServer(config.Port);
            httpServer.RequestEvent += (sender, e) => {
                var url = e.Request.RawUrl;
                if (url.IndexOf('?') >= 0) {
                    url = e.Request.RawUrl.Split('?')[0];
                }
                var httpmathod = e.Request.HttpMethod;
                e.Response = "accept";

                var m = regID.Match(url);
                if (m.Success) {
                    var idlist = new List<int>();
                    var idstr = m.Groups[1].Value;
                    if (idstr.IndexOf(',') > 0) {
                        var ids = idstr.Split(',');
                        foreach (var id in ids) {
                            idlist.Add(int.Parse(id));
                        }
                    }
                    else {
                        var id = int.Parse(idstr);
                        idlist.Add(id);
                    }
                    //var manager = category.getManger(getSelectedCategory());
                    //var items = manager.GetItem(idlist);
                    var items = category.GetItem(idlist);
                    var res = string.Empty;
                    switch (httpmathod) {
                        case "DELETE":
                            reqparam["method"] = "delete";
                            reqparam["id"] = m.Groups[1].Value;
                            serveBW.ReportProgress(1, reqparam);
                            break;
                        case "GET":
                            List<Data> list = items;// new List<Data>() { item };
                            res = JsonSerializer.Serialize(list);
                            e.Response = res;
                            break;
                        default:
                            break;
                    }

                    return;
//.........这里部分代码省略.........
开发者ID:mohammadul,项目名称:addondev,代码行数:101,代码来源:MainForm.cs


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