Пример #1
0
        private static void SetupListeners(Socket socket)
        {
            socket.On(Strings.SocketEvents.PONG, (data) =>
            {
                if (data.ToString().Equals("Pong!"))
                {
                    QuickAlert.ShowInfo(Strings.pingAlertTitle, Strings.pingSuccess);
                }
            });

            socket.On(Strings.SocketEvents.RECEIVED_DOWNLOAD_URL, (data) =>
            {
                Log.D(Strings.Tags.SOCKET_MANAGER, "DOWNLOAD URL RECEIVED");

                Log.D(Strings.Tags.SOCKET_MANAGER, (currentDelegate == null) ? "delegate is null" : "delegate isn't null");
                Log.D(Strings.Tags.SOCKET_MANAGER, (data == null) ? "data is null" : "data isn't null");

                if (currentDelegate != null && data != null)
                {
                    currentDelegate.DownloadURLReceived(data.ToString());
                    Log.D(Strings.Tags.SOCKET_MANAGER, "SENT TO DELEGATE");
                }
                else
                {
                    if (data == null)
                    {
                        QuickAlert.ShowError(Strings.resolveAlertTitle, Strings.resolveError);
                    }
                }
            });
        }
Пример #2
0
        public Form1()
        {
            InitializeComponent();

            navigationDrawerPanel_OriginalSize = navigationDrawerPanel.Size;

            closePictureBox_OriginalSize     = closePictureBox.Size;
            closePictureBox_OriginalLocation = closePictureBox.Location;

            navigationDrawerResizeTimer.Interval = 10; // Navigation Drawer Timer Interval for collapse animation
            closePictureBoxResizeTimer.Interval  = 10; // Close Buttom Timer Interval for zoom animation

            // Colors for Navigation Drawer state
            originalButtonColor = Color.FromArgb(255, 26, 32, 40);
            selectedButtonColor = Color.FromArgb(255, 0, 102, 204);

            // Set initial state
            ActivatePage(SelectedPanelButton.VIDEOS);

            panelManager.SetPanelOriginalSize(mainPanel_Videos);

            // Check if library path is set. If no library set, alert the user.
            if (PreferenceManager.GetLibraryLocation() == null || PreferenceManager.GetLibraryLocation().Trim().Equals(""))
            {
                QuickAlert.ShowInfo("Unable to Locate Library", "Please set a location to store your video files and library information to download videos.");
            }
        }
        public void DownloadURLReceived(string videoURL)
        {
            string libraryLocation = Retrieve.Default.LibraryLocation;

            Log.D(Strings.Tags.SEARCH_RESULT_VIDEO_OPTIONS_FORM, "libraryLocation: " + libraryLocation);
            Log.D(Strings.Tags.SEARCH_RESULT_VIDEO_OPTIONS_FORM, "videoURL: " + videoURL);

            if (libraryLocation != null && !libraryLocation.Equals(""))
            {
                FileDownloader.WithCompletionDelegate(context)
                .WithProgressDelegate(this)
                .WithVideoMetadata(currentResult)
                .GetFile(videoURL);
            }
            else
            {
                QuickAlert.ShowError(Strings.errorUnableToDownload, Strings.noDefaultLibrary);
            }
        }
Пример #4
0
        private void submitButton_Click(object sender, EventArgs e)
        {
            string query = queryTextBox.Text;

            if (query.Length == 0)
            {
                QuickAlert.ShowError(Strings.searchQueryEmptyAlertTitle, Strings.searchQueryEmptyAlertBody);
            }
            else
            {
                query = HttpUtility.UrlEncode(query);

                if (currentDelegate != null)
                {
                    currentDelegate.SendSearchQueryAsync(query);
                }

                this.Close();
            }
        }