Пример #1
0
        public MainPage()
        {
            bool Option;

            try
            {
                GoPGP pgp = new GoPGP();
                Option = pgp.ValidationKey();
            }
            catch
            {
                Option = false;
            }

            masterPage = new MasterPage();
            Master     = masterPage;
            Detail     = Option ? new NavigationPage(new HelloPage(false)) : new NavigationPage(new StartPage());

            masterPage.ListView.ItemSelected += OnItemSelected;

            if (Device.RuntimePlatform == Device.UWP)
            {
                MasterBehavior = MasterBehavior.Popover;
            }
        }
Пример #2
0
        async void SetKeys(object sender, EventArgs e)
        {
            GoPGP PGP = new GoPGP(EntryEmail.Text, EntryPass.Text, PublicTextEditor.Text, PrivateTextEditor.Text);

            if (PGP.ValidationKey())
            {
                await Navigation.PushAsync(new HelloPage(true));
            }
            else
            {
                await DisplayAlert("Уведомление", "Ошибка ключей!", "ОK");
            }
        }
Пример #3
0
        async void GetTextAsync(object sender, EventArgs e)
        {
            GoPGP GoPgp = new GoPGP();

            LabelEncryptedText.Text = "Результат:";

            string Result = "";

            try
            {
                Result             = Option? GoPgp.EncodeText(TextEditor.Text) : GoPgp.DecryptText(TextEditor.Text);
                EncryptedText.Text = Option ? Result.Substring(0, 300) + "..." : Result;
                await Clipboard.SetTextAsync(Result);
            }
            catch
            {
                await DisplayAlert("Ошибка!", "Не коректный текст!", "ОK");
            }
        }
Пример #4
0
        void ProcessFile(object sender, EventArgs e)
        {
            GoPGP GoPgp = new GoPGP();

            IWorkWithFile WorkFile = DependencyService.Get <IWorkWithFile>();
            string        WayHome  = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            int    index      = FilePath.LastIndexOf('\\');
            string PathFolder = FilePath.Substring(0, index);

            Task.Run(() => WorkFile.MoveToAsync(FilePath, WayHome));
            Thread.Sleep(1500);
            WayHome = Option ? GoPgp.DecodeFile(WayHome + "\\" + FileName) : GoPgp.EncodeFile(WayHome + "\\" + FileName);
            Task.Run(() => WorkFile.MoveToAsync(WayHome, PathFolder));
            Thread.Sleep(1500);

            ICloseApplication closer = DependencyService.Get <ICloseApplication>();

            closer?.closeApplication();
        }