示例#1
0
        private void LoadPluginData2(string pluginType)
        {
            new Thread((ThreadStart)(delegate()
            {
                try
                {
                    labloading.Invoke((MethodInvoker) delegate() { labloading.Visible = true; });

                    List <PluginClass> plist = new List <PluginClass>();

                    string url = CommonHelper.plugin_serverurl + "/Controller.aspx?controller=efwplus_website@PluginController&method=getpluginlist_client&plugintype=" + pluginType;
                    HttpWebResponse response = HttpWebResponseUtility.CreateGetHttpResponse(url, null, null, null);
                    string ret = HttpWebResponseUtility.GetHttpData(response);
                    string data = (HttpWebResponseUtility.ToResult(ret) as Newtonsoft.Json.JavaScriptArray).ToArray()[0].ToString();
                    DataTable dt = HttpWebResponseUtility.ToDataTable(JavaScriptConvert.DeserializeObject(data));

                    gridweb.Invoke((MethodInvoker) delegate() { gridweb.DataSource = dt; });

                    DataGridViewLabelXColumn bcx = gridweb.Columns["ctitle"] as DataGridViewLabelXColumn;
                    if (bcx != null)
                    {
                        bcx.BeforeCellPaint += bcx_BeforeCellPaint;
                    }

                    labloading.Invoke((MethodInvoker) delegate() { labloading.Visible = false; });
                }
                catch (Exception err)
                {
                    //MessageBox.Show("请求数据失败!\n" + err.Message);
                    MessageBoxEx.Show("请求数据失败!\n" + err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            })).Start();
        }
示例#2
0
        //发布
        private void btnissue_Click(object sender, EventArgs e)
        {
            try
            {
                if (txttitle.Text == "")
                {
                    MessageBoxEx.Show("别名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txttitle.Focus();
                    return;
                }
                if (txtauthor.Text == "")
                {
                    MessageBoxEx.Show("作者不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtauthor.Focus();
                    return;
                }

                if (txtversion.Text == "")
                {
                    MessageBoxEx.Show("版本号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtversion.Focus();
                    return;
                }

                if (txtdownloadpath.Text == "")
                {
                    MessageBoxEx.Show("先上传插件包!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtdownloadpath.Focus();
                    return;
                }

                if (cksrc.Checked)
                {
                    if (txtsrc.Text == "")
                    {
                        MessageBoxEx.Show("源代码包不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtsrc.Focus();
                        return;
                    }

                    if (txtdocs.Text == "")
                    {
                        MessageBoxEx.Show("设计文档不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtdocs.Focus();
                        return;
                    }
                }

                savepluginxml();

                IDictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("name", txtname.Text);
                parameters.Add("title", txttitle.Text);      //
                parameters.Add("author", txtauthor.Text);    //
                parameters.Add("pversion", txtversion.Text); //
                parameters.Add("plugintype", plugintype);
                parameters.Add("pluginsize", txtpluginsize.Text);
                parameters.Add("updatedate", txtupdatedate.Text);
                parameters.Add("introduction", txtintroduction.Text); //
                parameters.Add("headpic", pb_headpic.Tag.ToString()); //
                parameters.Add("updaterecord", txtupdaterecord.Text); //
                parameters.Add("downloadpath", txtdownloadpath.Text);
                parameters.Add("srcpath", "");
                parameters.Add("StartItem", txtStartItem.Text);//


                string          url      = CommonHelper.plugin_serverurl + "/Controller.aspx?controller=efwplus_website@PluginController&method=issueplugin";
                HttpWebResponse response = HttpWebResponseUtility.CreatePostHttpResponse(url, parameters, null, null, Encoding.UTF8, null);
                string          ret      = HttpWebResponseUtility.GetHttpData(response);

                //上传源代码和设计文档
                if (cksrc.Checked)
                {
                    string srcfile = txtsrc.Text;
                    string docfile = txtdocs.Text;
                    string docpic  = prjpath + "_pic";

                    //上传源代码
                    url = CommonHelper.plugin_serverurl + "/Controller.aspx?controller=efwplus_website@PluginController&method=uploadsrc&name=" + txtname.Text;
                    updateserver(url, srcfile);

                    url = CommonHelper.plugin_serverurl + "/Controller.aspx?controller=efwplus_website@PluginController&method=uploadvsd&name=" + txtname.Text;
                    updateserver(url, docfile);

                    DirectoryInfo dirs = new DirectoryInfo(docpic);
                    if (dirs.Exists)
                    {
                        foreach (FileInfo p in dirs.GetFiles())
                        {
                            string pic = p.FullName;
                            url = CommonHelper.plugin_serverurl + "/Controller.aspx?controller=efwplus_website@PluginController&method=uploaddoc_pic&name=" + txtname.Text;
                            updateserver(url, pic);
                        }
                    }
                }

                MessageBoxEx.Show("发布成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception err)
            {
                MessageBoxEx.Show("发布失败!\n" + err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#3
0
        //更新插件
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (gridlocal.CurrentCell == null)
                {
                    return;
                }
                List <PluginClass> plist = gridlocal.DataSource as List <PluginClass>;
                PluginClass        pc    = plist[gridlocal.CurrentCell.RowIndex];

                string          url          = CommonHelper.plugin_serverurl + "/Controller.aspx?controller=efwplus_website@PluginController&method=getplugin_client&name=" + pc.name;
                HttpWebResponse response     = HttpWebResponseUtility.CreateGetHttpResponse(url, null, null, null);
                string          ret          = HttpWebResponseUtility.GetHttpData(response);
                string          pversion     = (HttpWebResponseUtility.ToResult(ret) as JavaScriptObject)["pversion"].ToString();
                string          downloadpath = (HttpWebResponseUtility.ToResult(ret) as JavaScriptObject)["downloadpath"].ToString();
                string          p_url        = CommonHelper.plugin_serverurl + downloadpath;

                string path          = "";
                string localpath     = "";
                string pluginsysFile = "";
                if (pc.plugintype == "WebModulePlugin")
                {
                    path          = CommonHelper.WebPlatformPath + "\\" + pc.path;
                    localpath     = CommonHelper.WebPlatformPath + "\\ModulePlugin\\" + pc.name + ".zip";
                    pluginsysFile = CommonHelper.WebPlatformPath + "\\Config\\pluginsys.xml";
                }
                else if (pc.plugintype == "WinformModulePlugin")
                {
                    path          = CommonHelper.WinformPlatformPath + "\\" + pc.path;
                    localpath     = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + pc.name + ".zip";
                    pluginsysFile = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                }
                else if (pc.plugintype == "WcfModulePlugin")
                {
                    path          = CommonHelper.WinformPlatformPath + "\\" + pc.path;
                    localpath     = CommonHelper.WinformPlatformPath + "\\ModulePlugin\\" + pc.name + ".zip";
                    pluginsysFile = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                }
                PluginXmlManage.pluginfile = path;
                pluginxmlClass plugin = PluginXmlManage.getpluginclass();
                if (pversion == plugin.version)
                {
                    //MessageBox.Show("不用更新,已经是最新版的插件!");
                    MessageBoxEx.Show("不用更新,已经是最新版的插件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }


                frmprogress progress = new frmprogress();

                //下载
                UpDownLoadFileHelper updown = new UpDownLoadFileHelper();
                updown.Cdelegate = new UpDownLoadFileHelper.controldelegate(progress.refreshControl);
                updown.UpDown    = UpDownLoadFileHelper.updown.载;
                updown.Completed = delegate()
                {
                    progress.Close();
                    //先卸载原来插件
                    PluginSysManage.pluginsysFile = pluginsysFile;
                    PluginSysManage.DeletePlugin(pc.plugintype, pc.name);
                    Directory.Delete(new FileInfo(path).Directory.FullName, true);

                    //解压安装
                    if (CommonHelper.PluginSetup(localpath) == true)
                    {
                        File.Delete(localpath);
                        MessageBoxEx.Show("更新完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                };
                updown.Cancelled = delegate()
                {
                    progress.Close();

                    MessageBoxEx.Show("下载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                };
                updown.Start(p_url, localpath);
                progress.ShowDialog();
            }
            catch (Exception err)
            {
                MessageBoxEx.Show("更新失败!\r\n" + err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }