Exemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SignInDownloadStringCompleted(object sender, System.Net.UploadStringCompletedEventArgs e)
        {
            string xml = e.Result;
            string code = null;
            string pass = null;
            int view = 0;
            List<LibHeader> libKey = new List<LibHeader>();
            using (XmlReader reader = XmlReader.Create(new StringReader(xml)))
            {
                if (xml.IndexOf("<error>") > 0)
                {
                    BeanUtil.HideLoading();
                    reader.ReadToFollowing("error");
                    BeanUtil.ShowAlert(reader.ReadElementContentAsString());
                    return;
                }

                if (!reader.ReadToFollowing("code"))
                {
                    return;
                }
                code = reader.ReadElementContentAsString();

                pass = reader.ReadElementContentAsString();

                view = reader.ReadElementContentAsInt();

                if (reader.Name == "libs" || reader.ReadToNextSibling("libs"))
                {
                    while (reader.ReadToFollowing("lib"))
                    {
                        LibHeader header = new LibHeader();
                        header.FromXml(reader);
                        libKey.Add(header);

                        if (reader.Name == "atts" || reader.ReadToNextSibling("atts"))
                        {
                            List<LibDetail> libD = new List<LibDetail>();
                            if (reader.ReadToDescendant("att"))
                            {
                                LibDetail detail = new LibDetail();
                                detail.FromXml(reader);
                                libD.Add(detail);
                            }
                            while (reader.ReadToNextSibling("att"))
                            {
                                LibDetail detail = new LibDetail();
                                detail.FromXml(reader);
                                libD.Add(detail);
                            }
                            header.Details = libD;
                        }
                    }
                }
            }

            UserModel userMdl = new UserModel();
            if (userMdl.SignIn(_Name, pass, code))
            {
                userMdl.View = view;
                userMdl.LibKey = libKey;

                _Main.ShowUser();

                Awin mpwd = new Awin(userMdl);
                mpwd.InitView(_Main);
                mpwd.InitData();
            }
        }
Exemplo n.º 2
0
 private void BtOk_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     Awin view = new Awin();
     view.InitView(_Main);
     view.InitData();
 }