Ejemplo n.º 1
0
        private void SdkOnDownloadTxtCompleted(object sender, SdkEventArgs e)
        {
            if (e.Error == null)
            {
                if (this.isLaunch)
                {
                    var fileName = Path.GetFileName(this.downloadUsersFileName);
                    var filePath = this.GetFilePath(fileName);

                    this.LaunchFile(filePath);
                    this.isLaunch = false;
                }
            }
            else
            {
                this.ProcessError(e.Error);
            }

            fs2.Close();


            using (StreamWriter sr = new StreamWriter(this.downloadUsersFileName, true, Encoding.UTF8))
            {
                sr.WriteLine(userName + '-' + score);
            }
        }
Ejemplo n.º 2
0
        private void SdkOnUnpublishCompleted(object sender, SdkEventArgs e)
        {
            if (e.Error != null)
            {
                this.ProcessError(e.Error);
            }

            this.ChangeVisibilityOfProgressBar(Visibility.Collapsed);
        }
Ejemplo n.º 3
0
        private void SdkOnUploadCompleted(object sender, SdkEventArgs e)
        {
            if (e.Error != null)
            {
                this.uploadFileStream.Dispose();
                this.ProcessError(e.Error);
            }

            this.ChangeVisibilityOfProgressBar(Visibility.Collapsed);
        }
Ejemplo n.º 4
0
        private void SdkOnCopyCompleted(object sender, SdkEventArgs e)
        {
            if (e.Error == null)
            {
                this.InitFolder(this.currentPath);
            }
            else
            {
                this.ProcessError(e.Error);
            }

            this.ChangeVisibilityOfProgressBar(Visibility.Collapsed);
        }
Ejemplo n.º 5
0
        private void SdkOnUploadCompleted(object sender, SdkEventArgs e)
        {
            if (e.Error == null)
            {
            }
            else
            {
                this.ProcessError(e.Error);
            }

            fs2.Close();
            System.IO.File.Delete(this.downloadUsersFileName);
            stop = true;
        }
Ejemplo n.º 6
0
        private void SdkOnMakeFolderCompleted(object sender, SdkEventArgs e)
        {
            this.Dispatcher.BeginInvoke(() => { this.newFolderPopup.IsOpen = false; });
            if (e.Error != null)
            {
                this.ProcessError(e.Error);
            }
            else
            {
                this.InitFolder(this.currentPath);
            }

            this.ChangeVisibilityOfProgressBar(Visibility.Collapsed);
        }
Ejemplo n.º 7
0
        private void SdkOnDownloadCompleted(object sender, SdkEventArgs e)
        {
            if (e.Error == null)
            {
                if (this.isLaunch)
                {
                    var fileName = Path.GetFileName(this.downloadFileName);
                    var filePath = this.GetFilePath(fileName);

                    this.LaunchFile(filePath);
                    this.isLaunch = false;
                }
            }
            else
            {
                this.ProcessError(e.Error);
            }

            fs.Close();

            TagLib.File f = TagLib.File.Create(downloadFileName);
            currentSongName = f.Tag.FirstPerformer + " - " + f.Tag.Title;

            Dispatcher.BeginInvoke((Action)(() =>
            {
                foreach (int i in new List <int>()
                {
                    0, 1, 2
                })
                {
                    if (txtSongList[i] != currentSongName)
                    {
                        this.buttons[i].Content = txtSongList[i];
                    }
                    else
                    {
                        this.buttons[i].Content = txtSongList[3];
                    }
                }

                this.buttons[3].Content = currentSongName;
                this.buttons[3].Tag = "1";
                mp.Open(new Uri(this.downloadFileName, UriKind.RelativeOrAbsolute));
                mp.Play();
            }));

            txtSongList.Remove(currentSongName);
            f.Dispose();
        }
Ejemplo n.º 8
0
        private void SdkOnDownloadTxt2Completed(object sender, SdkEventArgs e)
        {
            if (e.Error == null)
            {
                if (this.isLaunch)
                {
                    var fileName = System.IO.Path.GetFileName(this.downloadUsersFileName);
                    var filePath = this.GetFilePath(fileName);

                    this.LaunchFile(filePath);
                    this.isLaunch = false;
                }
            }
            else
            {
                this.ProcessError(e.Error);
            }

            fs2.Close();

            using (StreamReader sr = new StreamReader(this.downloadUsersFileName))
            {
                while (!sr.EndOfStream)
                {
                    var      txt    = sr.ReadLine();
                    User     user   = new User();
                    string[] values = txt.Split(new char[] { '-' });
                    user.name  = values[0];
                    user.score = Int32.Parse(values[1]);
                    users.Add(user);
                }

                var sortedUsers = from user in users
                                  orderby user.score
                                  select new
                {
                    user.name,
                    user.score
                };


                sortedUsers = sortedUsers.Reverse();
                this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    gridResults.ItemsSource = sortedUsers.ToList();
                    System.IO.File.Delete(this.downloadUsersFileName);
                }));
            }
        }
Ejemplo n.º 9
0
        private void SdkOnDownloadCompleted(object sender, SdkEventArgs e)
        {
            if (e.Error == null)
            {
                if (this.isLaunch)
                {
                    this.Dispatcher.BeginInvoke(() => this.LaunchItem(this.holdItem));
                    this.isLaunch = false;
                }
            }
            else
            {
                this.ProcessError(e.Error);
            }

            this.ChangeVisibilityOfProgressBar(Visibility.Collapsed);
        }
Ejemplo n.º 10
0
        private void SdkOnDownloadCompleted(object sender, SdkEventArgs e)
        {
            if (e.Error == null)
            {
                if (this.isLaunch)
                {
                    var fileName = Path.GetFileName(this.downloadFileName);
                    var filePath = this.GetFilePath(fileName);

                    this.LaunchFile(filePath);
                    this.isLaunch = false;
                }
            }
            else
            {
                this.ProcessError(e.Error);
            }

            this.ChangeVisibilityOfProgressBar(Visibility.Collapsed);
        }