示例#1
0
        private async void poluchatel()
        {
            history = new List <History>();
            klad    = new List <Kladka>();

            zapis   = new History();
            kladadd = new Kladka();
            findsys = new FindSystem();

            StorageFolder folder = ApplicationData.Current.LocalFolder;

            StorageFile file_History = await folder.CreateFileAsync("db_history.xml", CreationCollisionOption.OpenIfExists);

            StorageFile file_Kladka = await folder.CreateFileAsync("db_kladka.xml", CreationCollisionOption.OpenIfExists);

            StorageFile file_FindSys = await folder.CreateFileAsync("db_findsys.xml", CreationCollisionOption.OpenIfExists);

            try
            {
                XmlSerializer xml_deser_history = new XmlSerializer(typeof(List <History>));
                XmlSerializer xml_deser_kladka  = new XmlSerializer(typeof(List <Kladka>));
                XmlSerializer xml_deser_findsys = new XmlSerializer(typeof(FindSystem));


                using (Stream stream_deser_history = await file_History.OpenStreamForReadAsync())
                {
                    history = (List <History>)xml_deser_history.Deserialize(stream_deser_history);
                }

                using (Stream stream_deser_kladka = await file_Kladka.OpenStreamForReadAsync())
                {
                    klad = (List <Kladka>)xml_deser_kladka.Deserialize(stream_deser_kladka);
                }

                using (Stream stream_deser_findsys = await file_FindSys.OpenStreamForReadAsync())
                {
                    findsys = (FindSystem)xml_deser_findsys.Deserialize(stream_deser_findsys);
                }
            }
            catch (Exception e)
            {
                var msg = new MessageDialog(e.ToString()).ShowAsync();
                otpravitel_find_sys("https://yandex.ru");
                otpravitel_History();
                otpravitel_kladki();
            }


            TabViewItem tab = new TabViewItem();

            tab.Header = "Новая вкладка";
            WebView web = new WebView();

            tab.Content = web;
            tabView.TabItems.Add(tab);
            web.Navigate(new Uri(findsys.findsystem));
            web.NavigationStarting += Web_SetAdress;
            web.NavigationFailed   += Web_Send;
            web.NewWindowRequested += Web_OpenWindow;
        }
示例#2
0
        private async void otpravitel_find_sys(string findSyS)
        {
            findsys = new FindSystem
            {
                findsystem = findSyS
            };

            StorageFolder folder = ApplicationData.Current.LocalFolder;

            StorageFile file_FindSys = await folder.CreateFileAsync("db_findsys.xml", CreationCollisionOption.OpenIfExists);

            XmlSerializer xml_ser_findsys = new XmlSerializer(typeof(FindSystem));

            using (Stream stream_ser_findsys = await file_FindSys.OpenStreamForWriteAsync())
            {
                xml_ser_findsys.Serialize(stream_ser_findsys, findsys);
            }

            MessageDialog msg = new MessageDialog(file_FindSys.Path);
            await msg.ShowAsync();
        }