Exemplo n.º 1
0
 public bool IsConnectedToInternet()
 {
     return(ConnectionChecker.IsConnectedToInternet());
 }
Exemplo n.º 2
0
 /// <summary>
 /// Stops the <see cref="ConnectionChecker"/> timer.
 /// </summary>
 public void Stop()
 {
     ConnectionChecker.Stop(); IsRunning = false;
 }
Exemplo n.º 3
0
 void Start()
 {
     MainGameHandler.RegisterSceneManager(this);
     ConnectionChecker.Unlock(true);
 }
Exemplo n.º 4
0
    public void OnIOError(IOErrorEvent ioError)
    {
        Debug.LogError ("IO Error event: " + ioError.Message);
        ConnectionChecker checker = new ConnectionChecker ();

        checker.check (
            delegate (bool success) {
                if (success) {
                    cleanupConnectionSuccessful(false,0);
                }else {
                    cleanupConnectionSuccessful(false,1);
                }
        });
    }
Exemplo n.º 5
0
 /// <summary>
 /// Starts the the <see cref="ConnectionChecker"/> timer.
 /// </summary>
 public void Start()
 {
     ConnectionChecker.Start(); IsRunning = true;
 }
Exemplo n.º 6
0
 //sprawdzanie spójności
 public bool DepthFirstSearch()
 {
     return(ConnectionChecker.DepthFirstSearch(Graph));
 }
Exemplo n.º 7
0
        /// <summary>
        /// Method for loading the image asynchronously
        /// </summary>
        /// <param name="data"></param>
        /// <param name="url"></param>
        private async void LoadImage(Intent data, string url)
        {
            mPuzzlePanel.RemoveView(mPicBoxWhole);
            mLayoutMessage.Visibility  = ViewStates.Gone;
            mLayoutProgress.Visibility = ViewStates.Visible;
            sTvProgress.Text           = "0%";
            GC.Collect(); // Must call Garbage Collector

            try
            {
                // Call BitmapMaker to draw the selected image into a resampled bitmap
                if (url == null)
                {
                    mImage = await BitmapMaker.CreateBitmapImage(640, 360, mPuzzlePanel.Width, mPuzzlePanel.Height - 2, data, this);

                    sCurrentLvl   = LVL_1_NUM;
                    mBtnPlay.Text = "Play";
                    Drawable img = ContextCompat.GetDrawable(this, Resource.Drawable.ic_play_white);
                    mBtnPlay.SetCompoundDrawablesWithIntrinsicBounds(img, null, null, null); // Set button icon
                }
                else
                {
                    // Check for network availability
                    if (ConnectionChecker.IsNetworkAvailable(this))
                    {
                        Bitmap result = await BitmapMaker.CreateBitmapImage(640, 360, mPuzzlePanel.Width, mPuzzlePanel.Height - 2, url, sTvProgress, this);

                        if (result != null)
                        {
                            mImage        = result;
                            sCurrentLvl   = LVL_1_NUM;
                            mBtnPlay.Text = "Play";
                            Drawable img = ContextCompat.GetDrawable(this, Resource.Drawable.ic_play_white);
                            mBtnPlay.SetCompoundDrawablesWithIntrinsicBounds(img, null, null, null); // Set button icon
                        }
                        else
                        {
                            string error = "Couldn't load the image. Please check the URL.";
                            AlertGenerator.ShowError(error, this);
                        }
                    }
                    else
                    {
                        string error = "Device is not connected to a network.";
                        AlertGenerator.ShowError(error, this);
                    }
                }
            }
            catch
            {
                string error = "There was a problem trying to load the image.";
                AlertGenerator.ShowError(error, this);
            }

            mPuzzlePanel.AddView(mPicBoxWhole);  // Add picBoxWhole to puzzlePanel
            mPicBoxWhole.SetImageBitmap(mImage); // Set the bitmap into the picBoxWhole imageView

            mLayoutProgress.Visibility = ViewStates.Gone;
            mLayoutMessage.Visibility  = ViewStates.Visible;

            if (mImage != null)
            {
                // Make btnPlay clickable
                mBtnPlay.Enabled = true;
                mBtnPlay.SetBackgroundResource(Resource.Drawable.btn_accent_style);
            }
        }
Exemplo n.º 8
0
 public void CanReturnConnectionStatus()
 {
     Assert.IsTrue(ConnectionChecker.IsConnectionAvailable());
 }
Exemplo n.º 9
0
        /// <summary>
        ///     Downloads the update package from the server.
        /// </summary>
        /// <exception cref="NetworkException">There is no network connection available.</exception>
        /// <exception cref="WebException">The download process has failed because of an <see cref="WebException"/>.</exception>
        /// <exception cref="ArgumentException">The URI of the update package is null.</exception>
        /// <seealso cref="DownloadPackageAsync"/>
        public void DownloadPackage()
        {
            if (_packageDownloader.IsBusy)
            {
                throw new InvalidOperationException(_lp.DownloadingProcessRunningExceptionText);
            }

            if (!ConnectionChecker.IsConnectionAvailable())
            {
                throw new NetworkException(_lp.NetworkConnectionExceptionText);
            }

            if (_updateConfiguration.UpdatePackageUri == null)
            {
                throw new ArgumentException("UpdatePackageUri");
            }

            if (!Directory.Exists(_applicationUpdateDirectory))
            {
                Directory.CreateDirectory(_applicationUpdateDirectory);
            }

            _updateFilePath = Path.Combine(_applicationUpdateDirectory, "update.zip");
            OnPackageDownloadStarted(this, EventArgs.Empty);
            _packageDownloader.Proxy = Proxy;
            _packageDownloader.DownloadFileCompleted += DownloadFileCompleted;
            _packageDownloader.DownloadFileAsync(_updateConfiguration.UpdatePackageUri,
                                                 _updateFilePath);
            _downloadResetEvent.WaitOne();

            if (_hasDownloadCancelled)
            {
                if (MustUpdate)
                {
                    Application.Exit();
                }
                return;
            }

            if (_hasDownloadFailed)
            {
                return;
            }

            if (_updateConfiguration.UseStatistics && _includeCurrentPcIntoStatistics)
            {
                try
                {
                    string response = new WebClient().DownloadString(String.Format("{0}?versionid={1}&os={2}",
                                                                                   _updateConfiguration.UpdatePhpFileUri, _updateConfiguration.VersionId,
                                                                                   SystemInformation.GetOperatingSystemName())); // Only for calling it
                    if (!String.IsNullOrEmpty(response))
                    {
                        OnStatisticsEntryFailed(new Exception(
                                                    String.Format(
                                                        _lp.StatisticsScriptExceptionText, response)));
                    }
                }
                catch (Exception ex)
                {
                    OnStatisticsEntryFailed(ex);
                }
            }

            OnPackageDownloadFinished(this, EventArgs.Empty);
        }
Exemplo n.º 10
0
 public bool IsReady()
 {
     return(CheckMe && ConnectionChecker.Check(this));
 }