Пример #1
0
        private void btnGlace_Click(object sender, RoutedEventArgs e)
        {
            Cursor currentCursor = Mouse.OverrideCursor;
            Mouse.OverrideCursor = Cursors.Wait;

            try
            {
                Zip zip = new Zip();
                string output = zip.CreatePackage(paths);

                if (!string.IsNullOrEmpty(output))
                {

                    string valutName = txtVaultName.Text;
                    Glacier.GlacierResult glacierResult = Glacier.Upload(valutName, output);

                    if (glacierResult.UploadResult != null &&
                        !string.IsNullOrEmpty(glacierResult.UploadResult.ArchiveId))
                    {
                        MessageBox.Show(string.Format("Glacier success \r\n ArchiveId is {0}", glacierResult.UploadResult.ArchiveId));
                        System.IO.File.Delete(output);

                        Data data = new Data();
                        data.Save(valutName, glacierResult.UploadResult.ArchiveId,
                            System.IO.Path.GetFileName(output), paths);

                    }
                    else
                    {

                        if (glacierResult.GlacierException != null)
                        {
                            MessageBox.Show(glacierResult.GlacierException.Message);
                        }
                        else if (glacierResult.AWSException != null)
                        {
                            MessageBox.Show(glacierResult.AWSException.Message);
                        }
                        else
                        {
                            MessageBox.Show(glacierResult.Exception.Message);
                        }

                        MessageBox.Show("Glacier fault...");
                    }
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Mouse.OverrideCursor = currentCursor;
            }
        }
Пример #2
0
        private void btnData_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Data data = new Data();
                DataTable dt = data.Get();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }