Пример #1
0
        private async void ReadSourceuserfromfile()
        {
            Task <bool> readta = new Task <bool>(() =>
            {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(Sourceuser));
                FileStream fileStreamuser   = new FileStream(FileSourceuser, FileMode.Open);
                sourceuser = (Sourceuser)xmlSerializer.Deserialize(fileStreamuser);
                FileStream fileStreamorigin = new FileStream(Filesourceorigin, FileMode.Open);
                sourceorigin = (Sourceuser)xmlSerializer.Deserialize(fileStreamorigin);

                return(true);
            });

            readta.Start();
            await readta;

            ApplySourceuser(sourceuser);
        }
Пример #2
0
        private async void WriteSourceusertofile()
        {
            Task <bool> writeta = new Task <bool>(() =>
            {
                Sourceuser sourceuser = new Sourceuser();
                Dispatcher.Invoke(() =>
                {
                    sourceuser.Allowmirrorscreen     = (bool)ALLOWMIRRORSCREEN.IsChecked;
                    sourceuser.Opacityofmirrorscreen = (int)OPACITYOFMIRROR.Value;
                    sourceuser.Pathsavesnapshoot     = PATHSAVESNAPSHOOT.Text;
                });
                FileStream fileStream       = new FileStream(FileSourceuser, FileMode.Create);
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(Sourceuser));

                xmlSerializer.Serialize(fileStream, sourceuser);
                return(true);
            });

            writeta.Start();
            await writeta;
        }
Пример #3
0
 private void ApplySourceuser(Sourceuser sourceuser)
 {
     ALLOWMIRRORSCREEN.IsChecked = sourceuser.Allowmirrorscreen;
     OPACITYOFMIRROR.Value       = sourceuser.Opacityofmirrorscreen;
     PATHSAVESNAPSHOOT.Text      = sourceuser.Pathsavesnapshoot;
 }