Exemple #1
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            Viddler.ViddlerService viddlerService = null;

            bool isUpdated = false;

            foreach (VideoListItem item in this.fileComboBox.Items)
            {
                if (item.IsChanged)
                {
                    if (viddlerService == null)
                    {
                        viddlerService = this.GetVidlerService();
                    }
                    if (viddlerService.Videos.SetDetails(item.Id, item.Title, item.Description, null, null, null, null, null, null, null, null, null, null) != null)
                    {
                        item.IsChanged = false;
                        isUpdated      = true;
                    }
                }
            }
            if (isUpdated)
            {
                this.LoadVideoList(viddlerService);
                MessageBox.Show("The videos have been updated successfully.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #2
0
        private void LoadVideoList(Viddler.ViddlerService viddlerService)
        {
            this.fileComboBox.Items.Clear();

            Viddler.Data.VideoList videoList = viddlerService.Videos.GetByUser();
            if (videoList != null && videoList.Items != null && videoList.Items.Count > 0)
            {
                foreach (Viddler.Data.Video video in videoList.Items)
                {
                    this.fileComboBox.Items.Add(new VideoListItem(video));
                }

                if (this.fileComboBox.Items.Count > 0)
                {
                    this.fileComboBox.SelectedIndex       = 0;
                    this.filePropertyGrid.SelectedObject  = ((VideoListItem)this.fileComboBox.SelectedItem);
                    this.actionPanel.ShowButton.Enabled   = true;
                    this.actionPanel.RemoveButton.Enabled = true;
                    this.actionPanel.UpdateButton.Enabled = true;
                    return;
                }
            }
            this.filePropertyGrid.SelectedObject  = null;
            this.actionPanel.ShowButton.Enabled   = false;
            this.actionPanel.RemoveButton.Enabled = false;
            this.actionPanel.UpdateButton.Enabled = false;
        }
Exemple #3
0
        private void uploadButton_Click(object sender, EventArgs e)
        {
            Viddler.ViddlerService viddlerService = this.GetVidlerService();

            if (this.uploadFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                this.uploadThread = new Thread(UploadVideoFile);
                this.uploadThread.Start(new object[] { viddlerService, this.uploadFileDialog.FileName });
            }
        }
Exemple #4
0
        private void connectButton_Click(object sender, EventArgs e)
        {
            Viddler.ViddlerService viddlerService = this.GetVidlerService();

            viddlerService.Users.Auth(this.authPanel.UserNameText.Text, this.authPanel.PasswordText.Text);
            if (viddlerService.IsAuthenticated)
            {
                this.sessionId = viddlerService.SessionId;

                this.authPanel.Visible               = false;
                this.actionPanel.Visible             = true;
                this.fileComboBox.Enabled            = true;
                this.filePropertyGrid.SelectedObject = new Viddler.Data.Video();

                this.LoadVideoList(viddlerService);
            }
        }
Exemple #5
0
        private void removeButton_Click(object sender, EventArgs e)
        {
            VideoListItem selectedItem = this.filePropertyGrid.SelectedObject as VideoListItem;

            if (selectedItem != null)
            {
                if (MessageBox.Show("Are you sure you want to delete this video?", "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    Viddler.ViddlerService viddlerService = this.GetVidlerService();

                    if (viddlerService.Videos.Delete(selectedItem.Id))
                    {
                        this.LoadVideoList(viddlerService);
                        MessageBox.Show("The video has been deleted successfully.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
Exemple #6
0
        private Viddler.ViddlerService GetVidlerService()
        {
            Viddler.ViddlerService viddlerService = new Viddler.ViddlerService();
            viddlerService.BaseUrl       = this.authPanel.UrlText.Text;
            viddlerService.SecureBaseUrl = this.authPanel.SecureUrlText.Text;
            viddlerService.ApiKey        = this.authPanel.ApiKeyText.Text;

            if (!string.IsNullOrEmpty(this.sessionId))
            {
                viddlerService.SessionId = this.sessionId;
            }

            viddlerService.BeginRequest += new EventHandler <Viddler.ViddlerRequestEventArgs>(viddlerService_BeginRequest);
            viddlerService.EndRequest   += new EventHandler <Viddler.ViddlerRequestEventArgs>(viddlerService_EndRequest);
            viddlerService.Error        += new EventHandler <Viddler.ViddlerRequestErrorEventArgs>(viddlerService_Error);
            viddlerService.Uploading    += new EventHandler <Viddler.ViddlerRequestUploadEventArgs>(viddlerService_Uploading);

            return(viddlerService);
        }
Exemple #7
0
    private Viddler.ViddlerService GetVidlerService()
    {
      Viddler.ViddlerService viddlerService = new Viddler.ViddlerService();
      viddlerService.BaseUrl = this.authPanel.UrlText.Text;
      viddlerService.SecureBaseUrl = this.authPanel.SecureUrlText.Text;
      viddlerService.ApiKey = this.authPanel.ApiKeyText.Text;

      if (!string.IsNullOrEmpty(this.sessionId))
      {
        viddlerService.SessionId = this.sessionId;
      }

      viddlerService.BeginRequest += new EventHandler<Viddler.ViddlerRequestEventArgs>(viddlerService_BeginRequest);
      viddlerService.EndRequest += new EventHandler<Viddler.ViddlerRequestEventArgs>(viddlerService_EndRequest);
      viddlerService.Error += new EventHandler<Viddler.ViddlerRequestErrorEventArgs>(viddlerService_Error);
      viddlerService.Uploading += new EventHandler<Viddler.ViddlerRequestUploadEventArgs>(viddlerService_Uploading);

      return viddlerService;
    }
Exemple #8
0
        private void UploadVideoFile(object data)
        {
            Viddler.ViddlerService viddlerService = (Viddler.ViddlerService)((object[])data)[0];
            string fileName = (string)((object[])data)[1];

            this.actionPanel.SetUploadProgress(0, true);

            Viddler.Data.Video newVideo = viddlerService.Videos.Upload("Just uploaded", "test,sample", "Test file", false, fileName);

            this.actionPanel.SetUploadProgress(100, false);

            if (newVideo != null)
            {
                MessageBox.Show("The new video has been uploaded successfully.\r\nThe video will appear on the list, after it is encoded by the server.\r\n\r\nWait few minutes and then press \"Refresh\" button\r\nto update the video list.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("The upload process has been aborted.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #9
0
        private void refreshButton_Click(object sender, EventArgs e)
        {
            Viddler.ViddlerService viddlerService = this.GetVidlerService();

            this.LoadVideoList(viddlerService);
        }