scintilla有可以在wpf里使用的wpf 设置版本号吗

WPF程序版本更新怎么做?
全部答案(共6个回答)
------解决方案--------------------------------------------------------functi...
这个问题我分两个点来答复您1.安装新版本的Windows系统如果您本身是Windows用户,并且想体验更新版本的操作系统的话您可以①下载您想使用的Windows...
根据不同MP4设备所用方案的不同,升级方式也不太一样。其实一般的MP4如果不是特别重大的更新的话不推荐升级(很多设备变砖的原因就是因为系统升级失败),最好根据M...
这个回复起来内容很多,恕我偷懒给你个别人写的连接自己看吧:http://www.blogjava.net/huanzhugege/archive/2008/04...
答: laguna的预定网站上显示要1/15以后才能预定吗?
答: cisco网络技术是一个为CTO、IT技术经理、网络工程师、安全工程师、数据库工程师、网络管理员、系统工程师、开发工程师、项目管理人员等IT技术人员搭建的有关先...
答: 我想学网页制作、网络维护、电脑维护可有比较好的学习网站或者论坛推选一下?你好!网易学院
大家还关注
确定举报此问题
举报原因(必选):
广告或垃圾信息
激进时政或意识形态话题
不雅词句或人身攻击
侵犯他人隐私
其它违法和不良信息
报告,这不是个问题
报告原因(必选):
这不是个问题
这个问题分类似乎错了
这个不是我熟悉的地区
相关问答:123456789101112131415WPF版本的自动更新程序
我的图书馆
WPF版本的自动更新程序
 最近,拿到的项目代码是用WPF写的。C/S结构的东西更新起来不太方便。于是,就决定做个自动更新程序吧。软件本身是用VS2010写的WPF版本的,所以更新程序也就决定用WPF来做吧。虽说,以前用WinForm做过,感觉应该是差不多。可实际操作过程中间,还是碰到了一些不太一样的地方吧。不过,原理都是一样一样滴。
  这里,只是更新程序的代码,至于版本判断的方法,方式多多吧。这里的更新程序,需要放在软件主程序同目录下,而且我把客户端的版本号放在了软件的配置文件中了。在更新完成后会去修改里边的版本信息。至于,zip包的解压,引用了ICSharpCode.SharpZipLib.dll,网上很多下载的。
  App.xaml.cs代码
using Susing System.Collections.Gusing System.Cusing System.Dusing System.Lusing System.W
namespace AutoUpdate{
&&& /// &summary&&&& /// App.xaml 的交互逻辑&&& /// &/summary&&&& public partial class App : Application&&& {&&&&&&& //重写OnStartup,获得启动程序&&&&&&& protected override void OnStartup(StartupEventArgs e)&&&&&&& {&&&&&&&&&&& if (e.Args != null && e.Args.Count() & 0)&&&&&&&&&&& {&&&&&&&&&&&&&&& this.Properties["startexe"] = e.Args[0];&&&&&&&&&&&&&&& this.Properties["version"] = e.Args[1];&&&&&&&&&&& }&&&&&&&&&&& base.OnStartup(e);&&&&&&& }& &&& }}
MainWindow.xaml.cs代码
using Susing System.Collections.Gusing System.Lusing System.Tusing System.Wusing System.Windows.Cusing System.Windows.Dusing System.Windows.Dusing System.Windows.Iusing System.Windows.Musing System.Windows.Media.Iusing System.Windows.Nusing System.Windows.Susing System.Nusing System.Cusing System.IO;using System.Dusing System.Xusing ICSharpCode.SharpZipLib.Z
namespace AutoUpdate{&&& /// &summary&&&& /// MainWindow.xaml 的交互逻辑&&& /// &/summary&&&& public partial class MainWindow : Window&&& {&&&&&&& //更新包地址&&&&&&& private string url = "";&&&&&&& //文件名字&&&&&&& private string filename = "";&&&&&&& //下载文件存放全路径&&&&&&& private string filepath = "";&&&&&&& //更新后打开的程序名&&&&&&& string startexe = "";&&&&&&& //新版本号&&&&&&& string version = "";
&&&&&&& public MainWindow()&&&&&&& {&&&&&&&&&&& InitializeComponent();
&&&&&&&&&&& pgbUpdate.Maximum = 3;
&&&&&&&&&&& if (Application.Current.Properties["startexe"] != null)&&&&&&&&&&& {&&&&&&&&&&&&&&& startexe = Application.Current.Properties["startexe"].ToString().Trim();&&&&&&&&&&& }
&&&&&&&&&&& if (Application.Current.Properties["version"] != null)&&&&&&&&&&& {&&&&&&&&&&&&&&& version = Application.Current.Properties["version"].ToString().Trim();&&&&&&&&&&& }
&&&&&&& private void Window_Activated(object sender, EventArgs e)&&&&&&& {&&&&&&&&&&& pgbUpdate.Value++;
&&&&&&&&&&& url = ConfigurationSettings.AppSettings["Url"].Trim();
&&&&&&&&&&& if (url != "")&&&&&&&&&&& {&&&&&&&&&&&&&&& filename = url.Substring(url.LastIndexOf("/") + 1);&&&&&&&&&&&&&&& //下载文件存放在临时文件夹中&&&&&&&&&&&&&&& filepath = Environment.GetEnvironmentVariable("TEMP") + @"/" +
&&&&&&&&&&&&&&& if (filename != "")&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&& try&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&& KillExeProcess();&&&&&&&&&&&&&&&&&&&&&&& DownloadFile();&&&&&&&&&&&&&&&&&&&&&&& UnZipFile();&&&&&&&&&&&&&&&&&&&&&&& UpdateVersionInfo();&&&&&&&&&&&&&&&&&&&&&&& OpenUpdatedExe();
&&&&&&&&&&&&&&&&&&&&&&& writeLog("更新成功!");&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&& catch (Exception ex)&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&& writeLog(ex.Message);&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&& else&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&& writeLog("更新失败:下载的文件名为空!");&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&& }
&&&&&&&&&&& else&&&&&&&&&&& {&&&&&&&&&&&&&&& writeLog("更新失败:未在App.config中指定需要下载的文件位置!");&&&&&&&&&&& }
&&&&&&&&&&& if (File.Exists(filepath))&&&&&&&&&&& {&&&&&&&&&&&&&&& File.Delete(filepath);&&&&&&&&&&& }
&&&&&&&&&&& this.Close();&&&&&&& }
&&&&&&& /// &summary&&&&&&&& /// 杀掉正在运行的需要更新的程序&&&&&&& /// &/summary&&&&&&&& private void KillExeProcess()&&&&&&& {&&&&&&&&&&& //后缀起始位置&&&&&&&&&&& int startpos = -1;
&&&&&&&&&&& try&&&&&&&&&&& {&&&&&&&&&&&&&&& if (startexe != "")&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&& if (startexe.EndsWith(".EXE"))&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&& startpos = startexe.IndexOf(".EXE");&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&& else if (startexe.EndsWith(".exe"))&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&& startpos = startexe.IndexOf(".exe");&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&& foreach (Process p in Process.GetProcessesByName(startexe.Remove(startpos)))&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&& p.Kill();
&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&& }&&&&&&&&&&& }&&&&&&&&&&& catch (Exception ex)&&&&&&&&&&& {&&&&&&&&&&&&&&& throw new Exception("清杀原程序进程出错:" + ex.Message);&&&&&&&&&&& }&&&&&&& }
&&&&&&& private void pgbUpdate_ValueChanged(object sender, RoutedPropertyChangedEventArgs&double& e)&&&&&&& {&&&&&&&&&&& pgbUpdate.Dispatcher.Invoke(new Action&DependencyProperty, object&(pgbUpdate.SetValue),&&&&&&&&&&&&&&& System.Windows.Threading.DispatcherPriority.Background, ProgressBar.ValueProperty, pgbUpdate.Value);&&&&&&& }
&&&&&&& /// &summary&&&&&&&& /// 下载更新包&&&&&&& /// &/summary&&&&&&&& public void DownloadFile()&&&&&&& {&&&&&&&&&&& pgbUpdate.Value++;
&&&&&&&&&&& WebClient client = new WebClient();&&&&&&&&&&& try&&&&&&&&&&& {&&&&&&&&&&&&&&& Uri address = new Uri(url);
&&&&&&&&&&&&&&& if (File.Exists(filepath))&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&& File.Delete(filepath);&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&& client.DownloadFile(address, filepath);
&&&&&&&&&&& }&&&&&&&&&&& catch (Exception ex)&&&&&&&&&&& {&&&&&&&&&&&&&&& throw new Exception("下载更新文件出错:" + ex.Message);&&&&&&&&&&& }
&&&&&&& private void UpdateVersionInfo()&&&&&&& {&&&&&&&&&&& try&&&&&&&&&&& {&&&&&&&&&&&&&&& Configuration cfa = ConfigurationManager.OpenExeConfiguration(startexe);&&&&&&&&&&&&&&& cfa.AppSettings.Settings["Version"].Value =&&&&&&&&&&&&&&& cfa.Save();&&&&&&&&&&& }&&&&&&&&&&& catch (Exception ex)&&&&&&&&&&& {&&&&&&&&&&&&&&& throw new Exception("更新版本信息出错:" + ex.Message);&&&&&&&&&&& }
&&&&&&& /// &summary&&&&&&&& /// 打开更新后的程序&&&&&&& /// &/summary&&&&&&&& private void OpenUpdatedExe()&&&&&&& {&&&&&&&&&&& try&&&&&&&&&&& {&&&&&&&&&&&&&&& if (ConfigurationManager.AppSettings["StartAfterUpdate"] == "true" && startexe != "")&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&& Process openupdatedexe = new Process();&&&&&&&&&&&&&&&&&&& openupdatedexe.StartInfo.FileName =&&&&&&&&&&&&&&&&&&& openupdatedexe.Start();&&&&&&&&&&&&&&& }&&&&&&&&&&& }&&&&&&&&&&& catch (Exception ex)&&&&&&&&&&& {&&&&&&&&&&&&&&& throw new Exception("打开更新后程序出错:" + ex.Message);&&&&&&&&&&& }&&&&&&& }
&&&&&&& #region 不好用&&&&&&& /// &summary&&&&&&&& /// 解压压缩包,格式必须是*.zip,否则不能解压&&&&&&& /// 需要添加System32下的Shell32.dll&&&&&&& /// 不好用总是弹出来对话框&&&&&&& /// &/summary&&&&&&&& //private void UnZip()&&&&&&& //{&&&&&&& //&&& try&&&&&&& //&&& {&&&&&&& //&&&&&&& ShellClass sc = new ShellClass();&&&&&&& //&&&&&&& Folder SrcFolder = sc.NameSpace(filepath);&&&&&&& //&&&&&&& Folder DestFolder = sc.NameSpace(System.Environment.CurrentDirectory);&&&&&&& //&&&&&&& FolderItems items = SrcFolder.Items();&&&&&&& //&&&&&&& DestFolder.CopyHere(items, 16);
&&&&&&& //&&& }&&&&&&& //&&& catch (Exception ex)&&&&&&& //&&& {&&&&&&& //&&&&&&& MessageBox.Show("解压缩更新包出错:" + ex.Message, "提示信息", MessageBoxButton.OK, MessageBoxImage.Error);&&&&&&& //&&& }&&&&&&& //}&&&&&&& #endregion
&&&&&&& #region 解压zip&&&&&&& /// &summary&&&&&&&& /// 解压压缩包,格式必须是*.zip,否则不能解压&&&&&&& /// &/summary&&&&&&&& /// &returns&&/returns&&&&&&&& private void UnZipFile()&&&&&&& {&&&&&&&&&&& pgbUpdate.Value++;
&&&&&&&&&&& try&&&&&&&&&&& {&&&&&&&&&&&&&&& using (ZipInputStream zis = new ZipInputStream(File.OpenRead(filepath)))&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&& ZipEntry theE&&&&&&&&&&&&&&&&&&& while ((theEntry = zis.GetNextEntry()) != null)&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&& string directoryName = System.IO.Path.GetDirectoryName(theEntry.Name);&&&&&&&&&&&&&&&&&&&&&&& string zipfilename = System.IO.Path.GetFileName(theEntry.Name);
&&&&&&&&&&&&&&&&&&&&&&& if (directoryName.Length & 0 && !Directory.Exists(directoryName))&&&&&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&&&&&& Directory.CreateDirectory(directoryName);&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& if (zipfilename != String.Empty)&&&&&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&&&&&& using (FileStream streamWriter = File.Create(theEntry.Name))&&&&&&&&&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& int size = 2048;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& byte[] data = new byte[2048];&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& while (true)&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& size = zis.Read(data, 0, data.Length);&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& if (size & 0)&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& streamWriter.Write(data, 0, size);&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& else&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&& }&&&&&&&&&&& }&&&&&&&&&&& catch (Exception ex)&&&&&&&&&&& {&&&&&&&&&&&&&&& throw new Exception("解压缩更新包出错:" + ex.Message);&&&&&&&&&&& }
&&&&&&& }&&&&&&& #endregion
&&&&&&& private void writeLog(string str)&&&&&&& {
&&&&&&&&&&& string strLog = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "& " + str + "/r/n";
&&&&&&&&&&& StreamWriter errorlog = new StreamWriter(System.bine(Environment.CurrentDirectory, @"log.txt"), true);&&&&&&&&&&& errorlog.Write(strLog);&&&&&&&&&&& errorlog.Flush();&&&&&&&&&&& errorlog.Close();&&&&&&& }&&& }}
更新程序的App.config
&?xml version="1.0" encoding="utf-8" ?&&configuration&& &appSettings&&&& &!--更新包下载地址,注意要是zip--&&&& &add key="Url" value=""/&&&& &!--更新完毕是否启动--&&&& &add key="StartAfterUpdate" value="false"/&& &/appSettings&&/configuration&
TA的最新馆藏
喜欢该文的人也喜欢WPF工具开发: 第三库选择
WPF工具开发: 第三库选择
编辑:www.fx114.net
本篇文章主要介绍了"WPF工具开发: 第三库选择",主要涉及到WPF工具开发: 第三库选择方面的内容,对于WPF工具开发: 第三库选择感兴趣的同学可以参考一下。
PropertyGrid Winforms's
非WPF原生支持, 需要借助WinFormHost风格不可定制 算是&官方&库, 风格不可定制 开源功能还不够完善可以定制风格 开源功能比较实用, 有自己的特色 商业控件 商业控件DockWindow
开源, 几乎是商用之外的最好选择 商业控件库 商业控件库RibbonBar
官方扩展功能单一 开源支持Office2010风格 商业控件库很方便的VS内嵌设计器最新版支持Office2010风格除了RibbonBar, 还有其它很实用的功能Chart
开源功能强大 开源 官方开源功能单一TextEditorSharpDevelop就是用这东西开发的, 还用说啥?这是Scintilla的.Net封装, 很有名的一个控件这个是收费的
版权声明:本文为博主原创文章,未经博主允许不得转载。
一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家社会集体的和公民的合法权益,不得利用本站制作、复制和传播不法有害信息!
二、互相尊重,对自己的言论和行为负责。
本文标题:
本页链接:1375人阅读
&注解:什么是XAML: Extensible Application Markup Language界面描述性语言运行环境: .net 2.0 + WinFX Runtime XAML关注界面编程,分离了界面与后台逻辑分离什么是WPF:
WinFX是下一代的Windows API,而WPF将是WinFX的核心一部分,用于处理UI, Document, Media和用户交互。
是java版本的XAML/WPF的解决方案,第一个发行版本已经可供下载: .在上面有个demo视频可以查看。此发行版包括了一套兼容WPF抽象的UI链接库,XAML启动器和SWT翻译器。提供了一个类似XAMLPAD的XAML编辑器简化eclipseer的开发,整个发行包可以看作是一个基于eclipse的面向RCP开发的程序包。eface包含了如下功能:&&& 完全支持XAML的语法和语意&&& 样式和模板&&& 布局系统&&& 线程安全&&& 完整的数据绑定机制&&& 聚集视图&&& 丰富的UI库Web/ajax的翻译器计划于2008年第一季度发布.
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:150142次
积分:2249
积分:2249
排名:第17010名
原创:72篇
评论:35条
(1)(1)(1)(1)(2)(2)(3)(2)(7)(2)(5)(6)(1)(2)(1)(1)(1)(1)(4)(2)(3)(1)(1)(3)(23)}

我要回帖

更多关于 wpf 设置版本号 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信