コード例 #1
0
        /// <summary>
        /// 获取本地配置文件
        /// </summary>
        /// <returns></returns>
        private ModuleInfo GetLocalVersion(string filePath)
        {
            //获取本地的升级文件
            //  string filePath = string.Format("{0}/{1}", xapInfo.FileName, VersionFileName);
            if (IosManager.ExistsFile(filePath))
            {
                using (Stream localfilesm = new MemoryStream(IosManager.GetFileBytes(filePath)))
                {
                    XElement xmlClient = XElement.Load(System.Xml.XmlReader.Create(localfilesm));

                    ModuleInfo modeuleInfo = (from c in xmlClient.DescendantsAndSelf("ModuleInfo")
                                              select new ModuleInfo
                    {
                        ModuleName = c.Elements("ModuleName").SingleOrDefault().Value,
                        Version = c.Elements("Version").SingleOrDefault().Value,
                        FileName = c.Elements("FileName").SingleOrDefault().Value,
                        EnterAssembly = c.Elements("EnterAssembly").SingleOrDefault().Value,
                        IsSave = c.Elements("IsSave").SingleOrDefault().Value,
                        HostAddress = c.Elements("HostAddress").SingleOrDefault().Value,
                        ServerID = c.Elements("ServerID").SingleOrDefault().Value,
                        ClientID = c.Elements("ClientID").SingleOrDefault().Value,
                        Description = c.Elements("Description").SingleOrDefault().Value,
                    }).FirstOrDefault();
                    return(modeuleInfo);
                }
            }
            else
            {
                return(new ModuleInfo()
                {
                    Version = "1.0.0.0000"
                });
            }
        }
コード例 #2
0
ファイル: Login.xaml.cs プロジェクト: jjg0519/OA
        /// <summary>
        /// 组件下载完成事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void webcDllVersion_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            try
            {
                if (e.Error != null)
                {
                    string msg = "下载版本文件出错,请联系管理员" + e.Error.ToString();
                    SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(msg);
                    SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                    HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", msg });
                    return;
                }
                if (e.Result.Length < 1)
                {
                    SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("获取服务器更新列表为空,请联系管理员");
                    SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                    txtUserMsg.Text = "获取服务器更新列表出错,请联系管理员";
                    HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", txtUserMsg.Text });
                    return;
                }
                //txtUserMsg.Text = "获取服务器更新列表成功,正在获取更新......";
                //将读取服务器下载的Dll Version XML
                StreamResourceInfo sXapSri             = new StreamResourceInfo(e.Result, "text/xml");
                Stream             manifestStream      = sXapSri.Stream;
                string             strVersionXmlServer = new StreamReader(manifestStream).ReadToEnd();
                //Linq to xml   manifestStream
                XElement dllVersionXElementServer     = XDocument.Parse(strVersionXmlServer).Root;
                var      dllVersionXElementlistServer = (from ent in dllVersionXElementServer.Elements().Elements()
                                                         select ent).ToList();

                //本地存在dllversion.xml文件
                if (IosManager.ExistsFile(dllVersionFilePath))
                {
                    //比较版本并下载新版本的dll及zip文件
                    IsolatedStorageFileStream xmlIsoStreamLocal = IosManager.GetFileStream(dllVersionFilePath);
                    StreamResourceInfo        sXapSrilocal      = new StreamResourceInfo(xmlIsoStreamLocal, "text/xml");
                    Stream versionXmlStreamLocal = sXapSrilocal.Stream;
                    string versionXmlLocal       = new StreamReader(versionXmlStreamLocal).ReadToEnd();
                    xmlIsoStreamLocal.Close();
                    if (string.IsNullOrEmpty(versionXmlLocal))
                    {
                        needDownDllNames = (from ent in dllVersionXElementlistServer
                                            select ent.Attribute("Source").Value).ToList();

                        DownLoadDll(needDownDllNames);
                        return;
                    }
                    XElement deploymentRoot       = XDocument.Parse(versionXmlLocal).Root;
                    var      dllVersionglistlocal = (from assemblyParts in deploymentRoot.Elements().Elements()
                                                     select assemblyParts).ToList();

                    var needUpdataDlls = from a in dllVersionXElementlistServer
                                         join b in dllVersionglistlocal
                                         on a.Attribute("Source").Value equals b.Attribute("Source").Value
                                             where a.Attribute("version").Value != b.Attribute("version").Value
                                         select a;

                    if (needUpdataDlls.Count() > 0)
                    {
                        //txtUserMsg.Text = "系统检查到更新,正在更新本地程序,请稍等......";
                        needDownDllNames = (from ent in needUpdataDlls
                                            select ent.Attribute("Source").Value).ToList();

                        DownLoadDll(needDownDllNames);
                    }
                    else
                    {
                        //从本地加载系统
                        LoadData(strApplicationPath + @"/SMT.SAAS.Platform.xap");
                    }
                }
                else
                {
                    //从服务器下载所有包
                    needDownDllNames = (from ent in dllVersionXElementlistServer
                                        select ent.Attribute("Source").Value).ToList();

                    DownLoadDll(needDownDllNames);
                }
            }
            catch (Exception ex)
            {
                string msg = "更新系统出错,请联系管理员:" + ex.ToString();
                HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", msg });
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(msg);
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                txtUserMsg.Text = "系统更新错误,请联系管理员";
            }
            finally
            {
                //存储versxml到本地
                byte[] streambyte = new byte[e.Result.Length];
                e.Result.Seek(0, SeekOrigin.Begin);
                e.Result.Read(streambyte, 0, streambyte.Length);
                e.Result.Close();
                IosManager.CreateFile(strApplicationPath, "DllVersion.xml", streambyte);
            }
        }
コード例 #3
0
ファイル: Login.xaml.cs プロジェクト: jjg0519/OA
        /// <summary>
        /// 加载数据包
        /// </summary>
        /// <param name="strXapName">xap包名称</param>
        private void LoadData(string strXapName)
        {
            string          sDllSourceName  = string.Empty;
            AssemblyPart    asmPart         = null;
            List <XElement> deploymentParts = new List <XElement>();

            try
            {
                #region "直接加载xap包中的dll"
                dtstart = DateTime.Now;
                using (var store = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication())
                {
                    //打开本地xap包流
                    IsolatedStorageFileStream sXapfileStream = store.OpenFile(strXapName, FileMode.Open, FileAccess.Read);
                    if (sXapfileStream.Length == 0)
                    {
                        //IosManager.DeletFile(ApplicationPath, "SMT.SAAS.Platform.Main.xap");
                        List <string> dllNames = new List <string>();
                        dllNames.Add("SMT.SAAS.Platform.xap");
                        DownLoadDll(dllNames);
                    }

                    #region Original Code
                    StreamResourceInfo srXapSri       = new StreamResourceInfo(sXapfileStream, "application/binary");
                    Stream             manifestStream = Application.GetResourceStream(srXapSri, new Uri("AppManifest.xaml", UriKind.Relative)).Stream;

                    string appManifest = new StreamReader(manifestStream).ReadToEnd();
                    manifestStream.Close();
                    //Linq to xml
                    XElement deploymentRoot = XDocument.Parse(appManifest).Root;
                    deploymentParts = (from assemblyParts in deploymentRoot.Elements().Elements()
                                       select assemblyParts).ToList();
                    //检测所有包是否在本地,不在,就从服务器上下载
                    bool          canStart  = true;
                    List <string> dllDelete = new List <string>();
                    foreach (XElement xElement in deploymentParts)
                    {
                        if (xElement.Attribute("Source").Value.Contains("zip") &&
                            !IosManager.ExistsFile(strApplicationPath + @"/" + xElement.Attribute("Source").Value))
                        {
                            dllDelete.Add(xElement.Attribute("Source").Value);
                            canStart = false;
                        }
                    }
                    if (!canStart)
                    {
                        DownLoadDll(dllDelete);
                        return;
                    }

                    StreamResourceInfo streamInfo;
                    //Assembly assemblyViewModel = null;
                    string message = string.Empty;
                    foreach (XElement xElement in deploymentParts)
                    {
                        try
                        {
                            sDllSourceName = xElement.Attribute("Source").Value;
                            dtstart        = DateTime.Now;
                            //setLoadmingMessage( "正在加载:" + DllSourceName);
                            if (!sDllSourceName.Contains("zip"))
                            {
                                //直接加载dll
                                asmPart        = new AssemblyPart();
                                asmPart.Source = sDllSourceName;
                                streamInfo     = Application.GetResourceStream(new StreamResourceInfo(sXapfileStream, "application/binary"), new Uri(sDllSourceName, UriKind.Relative));

                                if (sDllSourceName == "SMT.SAAS.Platform.dll")
                                {
                                    asmMain = asmPart.Load(streamInfo.Stream);
                                }
                                else
                                {
                                    var a = asmPart.Load(streamInfo.Stream);
                                    message = message + a.FullName + System.Environment.NewLine + "从DLL文件中直接加载程序集: " + a.FullName;
                                }
                                streamInfo.Stream.Close();
                            }
                            else
                            {
                                //加载zip包
                                //setLoadmingMessage("正在加载:" + DllSourceName);
                                if (sDllSourceName.Contains("zip"))
                                {
                                    //打开本地zip包流
                                    IsolatedStorageFileStream zipfileStream = IosManager.GetFileStream(strApplicationPath + @"/" + sDllSourceName);
                                    streamInfo     = Application.GetResourceStream(new StreamResourceInfo(zipfileStream, "application/binary"), new Uri(sDllSourceName.Replace("zip", "dll"), UriKind.Relative));
                                    asmPart        = new AssemblyPart();
                                    asmPart.Source = sDllSourceName.Replace("zip", "dll");
                                    var a = asmPart.Load(streamInfo.Stream);
                                    streamInfo.Stream.Close();
                                    message = message + a.FullName + System.Environment.NewLine + "从Zip文件中加载程序集: " + a.FullName;
                                    SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("从Zip文件中加载程序集: " + a.FullName);
                                }
                            }
                            dtend = DateTime.Now;
                            string strmsg = "加载成功:" + sDllSourceName + " 加载耗时: " + (dtend - dtstart).Milliseconds.ToString() + " 毫秒";
                            SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(strmsg);
                        }
                        catch (Exception ex)
                        {
                            string strmsg = "加载失败:" + sDllSourceName + " 错误信息: " + ex.ToString();
                            SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(strmsg);
                            SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                            setLoadmingMessage("系统加载出错,请联系管理员");
                            HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", strmsg });
                            return;
                        }
                    }
                    message = string.Empty;;
                    #endregion
                }
                #endregion

                setLoadmingMessage("系统检测更新完毕,正在打开单据,请稍后...");

                //return;
                if (isFirstUser == true)
                {
                    //MainPage = asmMain.CreateInstance("SMT.SAAS.Platform.Xamls.MainPage") as UIElement;
                    uMainPage = asmMain.CreateInstance("SMT.SAAS.Platform.Xamls.MVCMainPage") as UIElement;
                    if (uMainPage == null)
                    {
                        MessageBox.Show("系统加载错误,请清空silverlight缓存后再试,或联系管理员");
                        setLoadmingMessage("系统加载错误,请清空silverlight缓存后再试,或联系管理员");
                        return;
                    }
                    AppContext.AppHost.SetRootVisual(uMainPage);
                }
            }
            catch (Exception ex)
            {
                HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", ex.ToString() });
                this.txtUserMsg.Text = @"silverlight本地存储异常,请右键点击silverlight"
                                       + System.Environment.NewLine + "选择应用程序存储,然后点击全部删除后刷新页面再试";
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(sDllSourceName + " 加载系统出错:" + ex.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
            }
        }
コード例 #4
0
ファイル: Login.xaml.cs プロジェクト: jjg0519/OA
        /// <summary>
        ///  检查登录
        /// </summary>
        private void CheckLoginUser()
        {
            try
            {
                if (!IosManager.CheckeSpace())
                {
                    try
                    {
                        if (!IosManager.AddSpace())
                        {
                            MessageBox.Show("请增加独立存储空间,否则系统无法运行");
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("增加独立存储空间出错,原因如下:" + ex.ToString());
                    }
                }

                if (!IosManager.ExistsFile(strApplicationPath))
                {
                    IosManager.CreatePath(strApplicationPath);
                    isFirstUser     = true;
                    txtUserMsg.Text = "初次访问协同办公系统,请点击上方按钮--增加系统存储空间,以确保系统能正常运行";
                }

                btnAddSpace.Visibility = System.Windows.Visibility.Collapsed;

                string strUid = string.Empty, strUserName = string.Empty;

                if (Application.Current.Resources["CurrentSysUserID"] != null)
                {
                    strUid = Application.Current.Resources["CurrentSysUserID"].ToString();
                }

                if (Application.Current.Resources["username"] != null)
                {
                    strUserName = Application.Current.Resources["username"].ToString();
                }

                if (string.IsNullOrWhiteSpace(strUid) || string.IsNullOrWhiteSpace(strUserName))
                {
                    txtUserMsg.Text = "警告!用户信息异常,不能执行当前的操作请求。";
                    if (string.IsNullOrWhiteSpace(strUid))
                    {
                        AppContext.SystemMessage("传入的用户CurrentSysUserID为空");
                        AppContext.ShowSystemMessageText();
                    }
                    if (string.IsNullOrWhiteSpace(strUserName))
                    {
                        AppContext.SystemMessage("传入的用户username为空");
                        AppContext.ShowSystemMessageText();
                    }
                    return;
                }

                if (!App.AppSettings.Contains(USERKEY))
                {
                    App.AppSettings.Add(USERKEY, strUserName);
                    isFirstUser = true;
                }
                else
                {
                    App.AppSettings[USERKEY] = strUserName;
                }

                sysloginClinet.GetUserInfobyIDAsync(strUid);
                //txtUserMsg.Text = "系统正在加载,请稍等......";
            }
            catch (Exception ex)
            {
                btnAddSpace.Visibility = System.Windows.Visibility.Visible;
                string msg = "系统错误,请联系管理员:" + ex.ToString();
                txtUserMsg.Text = msg;
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(msg);
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", msg });
            }
        }
コード例 #5
0
        /// <summary>
        /// 组件下载完成事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void webcDllVersion_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            try
            {
                if (e.Error != null)
                {
                    SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("下载版本文件出错,请联系管理员" + e.Error.ToString());
                    SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                    return;
                }
                if (e.Result.Length < 1)
                {
                    SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("获取服务器更新列表为空,请联系管理员");
                    SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                    Loginform.NotifyUserMessage("获取服务器更新列表出错,请联系管理员");
                    return;
                }
                Loginform.NotifyUserMessage("获取服务器更新列表成功,正在获取更新......");
                //将读取服务器下载的Dll Version XML
                StreamResourceInfo XapSri              = new StreamResourceInfo(e.Result, "text/xml");
                Stream             manifestStream      = XapSri.Stream;
                string             strVersionXmlServer = new StreamReader(manifestStream).ReadToEnd();
                //Linq to xml   manifestStream
                XElement dllVersionXElementServer     = XDocument.Parse(strVersionXmlServer).Root;
                var      dllVersionXElementlistServer = (from ent in dllVersionXElementServer.Elements().Elements()
                                                         select ent).ToList();

                //本地存在dllversion.xml文件
                if (IosManager.ExistsFile(dllVersionFilePath))
                {
                    //比较版本并下载新版本的dll及zip文件
                    IsolatedStorageFileStream xmlIsoStreamLocal = IosManager.GetFileStream(dllVersionFilePath);
                    StreamResourceInfo        XapSrilocal       = new StreamResourceInfo(xmlIsoStreamLocal, "text/xml");
                    Stream versionXmlStreamLocal = XapSrilocal.Stream;
                    string versionXmlLocal       = new StreamReader(versionXmlStreamLocal).ReadToEnd();
                    xmlIsoStreamLocal.Close();
                    if (string.IsNullOrEmpty(versionXmlLocal))
                    {
                        needDownDllNames = (from ent in dllVersionXElementlistServer
                                            select ent.Attribute("Source").Value).ToList();

                        DownLoadDll(needDownDllNames);
                        return;
                    }
                    XElement deploymentRoot       = XDocument.Parse(versionXmlLocal).Root;
                    var      dllVersionglistlocal = (from assemblyParts in deploymentRoot.Elements().Elements()
                                                     select assemblyParts).ToList();

                    var needUpdataDlls = from a in dllVersionXElementlistServer
                                         join b in dllVersionglistlocal
                                         on a.Attribute("Source").Value equals b.Attribute("Source").Value
                                             where a.Attribute("version").Value != b.Attribute("version").Value
                                         select a;

                    if (needUpdataDlls.Count() > 0)
                    {
                        Loginform.NotifyUserMessage("系统检测到更新,正在更新本地程序,请稍等......");
                        needDownDllNames = (from ent in needUpdataDlls
                                            select ent.Attribute("Source").Value).ToList();

                        DownLoadDll(needDownDllNames);
                    }
                    else
                    {
                        //判断是否所有dll都在本地存在,处理那种下载途中断网后的问题
                        List <string> needDownload = new List <string>();
                        foreach (var q in dllVersionglistlocal)
                        {
                            string filepath = strApplicationPath + @"/" + q.Attribute("Source").Value;
                            if (!IosManager.ExistsFile(filepath))
                            {
                                Loginform.NotifyUserMessage(@"silverlight本地存储异常,请右键点击silverlight
                                ,选择应用程序存储,然后点击全部删除后刷新页面再试");
                                needDownload.Add(q.Attribute("Source").Value);
                                break;
                            }
                        }
                        if (needDownload.Count() > 0)
                        {
                            //DownLoadDll(needDownload);
                        }
                        else
                        {
                            if (UpdateDllCompleted != null)
                            {
                                UpdateDllCompleted(this, null);
                            }
                        }
                    }
                }
                else
                {
                    //从服务器下载所有包
                    needDownDllNames = (from ent in dllVersionXElementlistServer
                                        select ent.Attribute("Source").Value).ToList();

                    DownLoadDll(needDownDllNames);
                }
            }
            catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("更新系统出错,请联系管理员:" + ex.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                Loginform.NotifyUserMessage("系统更新错误,请联系管理员");
            }
            finally
            {
                //存储versxml到本地
                byte[] streambyte = new byte[e.Result.Length];
                e.Result.Seek(0, SeekOrigin.Begin);
                e.Result.Read(streambyte, 0, streambyte.Length);
                e.Result.Close();
                IosManager.CreateFile(strApplicationPath, "DllVersion.xml", streambyte);
            }
        }
コード例 #6
0
        private void LoadAssemblyPart(Object state)
        {
            string          XapName         = strApplicationPath + @"/SMT.SAAS.Platform.xap";
            string          DllSourceName   = string.Empty;
            AssemblyPart    asmPart         = null;
            List <XElement> deploymentParts = new List <XElement>();

            try
            {
                #region "直接加载xap包中的dll"
                dtstart = DateTime.Now;
                using (var store = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication())
                {
                    //打开本地xap包流

                    IsolatedStorageFileStream XapfileStream = store.OpenFile(XapName, FileMode.Open, FileAccess.Read);
                    if (XapfileStream.Length == 0)
                    {
                        //IosManager.DeletFile(ApplicationPath, "SMT.SAAS.Platform.Main.xap");
                        List <string> dllNames = new List <string>();
                        dllNames.Add("SMT.SAAS.Platform.xap");
                        DownLoadDll(dllNames);
                    }

                    #region Original Code
                    StreamResourceInfo XapSri         = new StreamResourceInfo(XapfileStream, "application/binary");
                    Stream             manifestStream = Application.GetResourceStream(XapSri, new Uri("AppManifest.xaml", UriKind.Relative)).Stream;

                    string appManifest = new StreamReader(manifestStream).ReadToEnd();
                    manifestStream.Close();
                    //Linq to xml
                    XElement deploymentRoot = XDocument.Parse(appManifest).Root;
                    deploymentParts = (from assemblyParts in deploymentRoot.Elements().Elements()
                                       select assemblyParts).ToList();
                    //检测所有包是否在本地,不在,就从服务器上下载
                    bool          canStart  = true;
                    List <string> dllDelete = new List <string>();
                    foreach (XElement xElement in deploymentParts)
                    {
                        if (xElement.Attribute("Source").Value.Contains("zip") &&
                            !IosManager.ExistsFile(strApplicationPath + @"/" + xElement.Attribute("Source").Value))
                        {
                            dllDelete.Add(xElement.Attribute("Source").Value);
                            canStart = false;
                        }
                    }
                    if (!canStart)
                    {
                        DownLoadDll(dllDelete);
                        return;
                    }

                    StreamResourceInfo streamInfo;
                    //Assembly assemblyViewModel = null;
                    foreach (XElement xElement in deploymentParts)
                    {
                        try
                        {
                            DllSourceName = xElement.Attribute("Source").Value;
                            dtstart       = DateTime.Now;
                            //form.setLoadmingMessage( "正在加载:" + DllSourceName);
                            if (!DllSourceName.Contains("zip"))
                            {
                                //直接加载dll
                                asmPart        = new AssemblyPart();
                                asmPart.Source = DllSourceName;
                                streamInfo     = Application.GetResourceStream(new StreamResourceInfo(XapfileStream, "application/binary"), new Uri(DllSourceName, UriKind.Relative));

                                if (DllSourceName == "SMT.SAAS.Platform.dll")
                                {
                                    asmMain = asmPart.Load(streamInfo.Stream);
                                }
                                else
                                {
                                    var a = asmPart.Load(streamInfo.Stream);
                                }
                                streamInfo.Stream.Close();
                            }
                            else
                            {
                                //加载zip包
                                //form.setLoadmingMessage("正在加载:" + DllSourceName);
                                if (DllSourceName.Contains("zip"))
                                {
                                    //打开本地zip包流
                                    IsolatedStorageFileStream zipfileStream = IosManager.GetFileStream(strApplicationPath + @"/" + DllSourceName);
                                    streamInfo     = Application.GetResourceStream(new StreamResourceInfo(zipfileStream, "application/binary"), new Uri(DllSourceName.Replace("zip", "dll"), UriKind.Relative));
                                    asmPart        = new AssemblyPart();
                                    asmPart.Source = DllSourceName.Replace("zip", "dll");
                                    var a = asmPart.Load(streamInfo.Stream);
                                    streamInfo.Stream.Close();
                                    SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("从Zip文件中加载程序集: " + a.FullName);
                                }
                            }
                            dtend = DateTime.Now;
                            string strmsg = "加载成功:" + DllSourceName + " 加载耗时: " + (dtend - dtstart).Milliseconds.ToString() + " 毫秒";
                            SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(strmsg);
                        }
                        catch (Exception ex)
                        {
                            string strmsg = "加载失败:" + DllSourceName + " 错误信息: " + ex.ToString();
                            SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(strmsg);
                            SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                            Loginform.NotifyUserMessage("系统加载出错,请联系管理员");
                            return;
                        }
                    }

                    #endregion
                }
                #endregion

                Loginform.NotifyUserMessage("系统检测更新完毕,请您登录系统");
                Loginform.setbtnLoginEnable(true);
            }
            catch (Exception ex)
            {
                Loginform.NotifyUserMessage(@"silverlight本地存储异常,请右键点击silverlight
                                ,选择应用程序存储,然后点击全部删除后刷新页面再试");
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(DllSourceName + " 加载系统出错:" + ex.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
            }
        }
コード例 #7
0
        void LoginForm_Loaded(object sender, RoutedEventArgs e)
        {
            btnLogin.IsEnabled = false;

            if (App.AppSettings.Contains(USERKEY))
            {
                txbUserName.Text = App.AppSettings[USERKEY].ToString();
            }

            if (Application.Current.Resources["username"] != null &&
                Application.Current.Resources["userpwd"] != null)
            {
                this.txbUserName.Text         = Application.Current.Resources["username"].ToString();
                this.txbUserPassword.Password = Application.Current.Resources["userpwd"].ToString();
                isAutoloaded = true;
                MainPageManeger.isAutoloaded = this.isAutoloaded;
            }

            if (string.IsNullOrEmpty(txbUserName.Text))
            {
                txbUserName.Focus();
                //txbUserName.Text = "smtwangl";
                //txbUserPassword.Password = "******";
            }
            else
            {
                txbUserPassword.Focus();
            }
            if (IosManager.ExistsFile(dllVersionFilePath))
            {
                //判断所有文件是否在本地存在
                SMT.SaaS.LocalData.Tables.V_UserLogin us = new SaaS.LocalData.Tables.V_UserLogin();
                //us = SMT.SaaS.LocalData.ViewModel.V_UserLoginVM.Get_V_UserLogin(txbUserName.Text);
                if (IsolatedStorageSettings.ApplicationSettings.Contains("user"))
                {
                    us = IsolatedStorageSettings.ApplicationSettings["user"] as SMT.SaaS.LocalData.Tables.V_UserLogin;
                }
                if (!string.IsNullOrEmpty(us.EMPLOYEEID))
                {
                    isFirstUser = false;
                    MainPageManeger.isFirstUser = false;
                    NotifyUserMessage("系统正在检测更新,请您稍等......");
                    MainPageManeger.dllVersionUpdataCheck();
                }
                else
                {
                    isFirstUser        = true;
                    btnLogin.IsEnabled = true;
                    NotifyUserMessage("您第一次使用系统,需要下载较多内容,登录后请您耐心等候");
                }
            }
            else
            {
                isFirstUser = true;
            }

            if (isFirstUser)
            {
                btnLogin.IsEnabled     = true;
                txtLoadingMessage.Text = "您第一次使用系统,需要下载较多内容,登录后请您耐心等候";
            }
        }
コード例 #8
0
        /// <summary>
        /// 系统登录
        /// </summary>
        public void userloading()
        {
            btnLogin.IsEnabled = false;
            try
            {
                if (!IosManager.CheckeSpace())
                {
                    try
                    {
                        if (!IosManager.AddSpace())
                        {
                            MessageBox.Show("请增加独立存储空间,否则系统无法运行");
                            btnLogin.IsEnabled = true;
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("增加独立存储空间出错,请联系管理员" + ex.ToString());
                    }
                }

                if (!IosManager.ExistsFile(ApplicationPath))
                {
                    IosManager.CreatePath(ApplicationPath);
                }
                if (!IsAllFilled())
                {
                    btnLogin.IsEnabled = true;
                    return;
                }
                if (!App.AppSettings.Contains(USERKEY))
                {
                    App.AppSettings.Add(USERKEY, txbUserName.Text);
                }
                else
                {
                    App.AppSettings[USERKEY] = txbUserName.Text;
                }

                string UserPwdMD5 = string.Empty;
                if (Application.Current.Resources["userpwd"] != null)
                {
                    UserPwdMD5 = Application.Current.Resources["userpwd"].ToString();
                }
                else
                {
                    UserPwdMD5 = MD5.GetMd5String(this.txbUserPassword.Password);
                }
                sysloginClinet.SystemLoginAsync(this.txbUserName.Text, UserPwdMD5);

                txtLoadingMessage.Text = "开始登录系统,请稍等......";
                DateTime dtstart = DateTime.Now;
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("开始登录系统,请稍等......");

                //sysloginClinet.SystemLoginAsync(this.txbUserName.Text, Utility.Encrypt(this.txbUserPassword.Password));
            }
            catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("系统错误,请联系管理员:" + ex.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                btnLogin.IsEnabled = true;
            }
        }