Exemplo n.º 1
0
        private void GoToError1AndThrow(Exception innerException, bool rollback = false)
        {
            //rollbackフラグがTrueの場合、ROLLBACKする
            if (rollback)
            {
                try {
                    this.RollbackImp();
                } catch {
                    innerException = new DbAccessException("トランザクションの取消に失敗しました", innerException);
                }
            }

            //DBから切断する
            //(Open()前にClose()を実行してもエラーにはならない)
            try {
                this.Close();
            } catch {
                innerException = new DbAccessException("DBからの切断に失敗しました", innerException);
            }

            //Error1状態に遷移する
            // Added in 20181010
            this.GoToNextState(Error1.GetInstance());

            //例外を再送出する
            throw innerException;
        }
Exemplo n.º 2
0
        private void onclick(object sender, RoutedEventArgs e)
        {
            abc.Text   = "";
            _notstop   = true;
            pausecheck = false;

            ////DEBUG

            //if (_allowedToRun) tex1.Text = "true";
            //else tex1.Text = "false";
            //if (_notstop) tex2.Text = "true";
            //else tex2.Text = "false";
            //if (pausecheck) tex3.Text = "true";
            //else tex3.Text = "false";
            //tex4.Text = BytesWritten.ToString();


            ////END DEBUG

            try
            {
                url1     = new Uri(URL.Text);
                fileName = Locat.Text + System.IO.Path.GetFileName(url1.LocalPath);
            }
            catch
            {
                Error1 win2 = new Error1();
                win2.ShowDialog();
                return;
            }
            _source      = URL.Text;
            _destination = fileName;
            percl        = GetContentLength();
            if (!File.Exists(_destination))
            {
                Start();
            }
            else
            {
                Window1 Win = new Window1();
                Win.ShowDialog();

                if (Win.check == 1)
                {
                    abc.Text = "File to be overwritten";
                    File.Delete(_destination);
                    Start();
                    abc.Text = "Done" + GetContentLength().ToString();
                }
                else
                {
                    abc.Text = "Operation Aborted";
                }
            }
            abc.Text = "Done" + GetContentLength().ToString();
            //{
            //    abc.Text = "Download Complete";
            //}
        }
Exemplo n.º 3
0
        private void videoget()
        {
            string link;
            IEnumerable <VideoInfo> videoInfos;

            try
            {
                link       = youtlink.Text;
                videoInfos = DownloadUrlResolver.GetDownloadUrls(link);
            }
            catch
            {
                Error1 e1 = new Error1();
                e1.ShowDialog();
                return;
            }
            quality q1 = new quality();

            id_prog.Visibility = System.Windows.Visibility.Visible;
            q1.ShowDialog();
            qual = q1.quali;

            VideoInfo video;// = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);

            try
            {
                video = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == qual);
            }
            catch
            {
                tb3.Text = "Unavailable";
                video    = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
            }
            id_prog.Visibility = System.Windows.Visibility.Hidden;
            tb3.Text           = video.Resolution.ToString();
            fileName           = Locat.Text + video.Title + ".mp4"; //System.IO.Path.GetFileName(url1.LocalPath);
            _source            = video.DownloadUrl;
            _destination       = fileName;
            percl = GetContentLength();
            if (!File.Exists(_destination))
            {
                Start();
            }
            else
            {
                Window1 Win = new Window1();
                Win.ShowDialog();

                if (Win.check == 1)
                {
                    abc.Text = "File to be overwritten";
                    File.Delete(_destination);
                    Start();
                    abc.Text = "Done ";
                }
                else
                {
                    abc.Text = "Operation Aborted";
                }
            }
        }