Example #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;
        }
Example #2
0
        private async void otpravitel_kladki(string uri = "")
        {
            kladadd = new Kladka
            {
                kladka = uri
            };

            klad.Add(kladadd);

            StorageFolder folder = ApplicationData.Current.LocalFolder;

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

            XmlSerializer xml_ser_kladka = new XmlSerializer(typeof(List <Kladka>));

            using (Stream stream_ser_kladka = await file_Kladka.OpenStreamForWriteAsync())
            {
                xml_ser_kladka.Serialize(stream_ser_kladka, klad);
            }
        }