示例#1
0
    private void DrawAt(Vector2 position, PointerEventData.InputButton button)
    {
        if (brush == null)
        {
            return;
        }
        PointerState pointerState = this.pointerState[(int)button];
        Vector2      vector       = UIEx.Unpivot(rectTransform, position);

        if (pointerState.isDown)
        {
            Vector2 vector2    = pointerState.lastPos - vector;
            Vector2 normalized = vector2.normalized;
            for (float num = 0f; num < vector2.magnitude; num += Mathf.Max(brush.spacing, 1f) * Mathf.Max(spacingScale, 0.1f))
            {
                onDrawing.Invoke(vector + num * normalized, brush);
            }
            pointerState.lastPos = vector;
        }
        else
        {
            onDrawing.Invoke(vector, brush);
            pointerState.lastPos = vector;
        }
    }
示例#2
0
 public async Task <Stats> Encrypt(Action <int> reporter)
 {
     try
     {
         using (var sourceStream = File.OpenRead(_sourceFilePath))
             using (var destinationStream = File.OpenWrite(EncryptedFilePath))
             {
                 _cryptor.EncryptDestination = destinationStream;
                 return(await CypherEngine.Encrypt(_cryptor, sourceStream, BUFFER_SIZE, new Progress <int>(reporter)));
             }
     } catch (Exception exception)
     {
         UIEx.ShowNotice("Exception", exception.Message);
     }
     return(new Stats());
 }
示例#3
0
        private async void actionButton_Click(object sender, EventArgs e)
        {
            progressBar.Value = 0;
            //actionButton.Enabled = false;

            Action <int> reporter = progress => {
                progressBar.Value = progress;
            };
            var stats = _decryptActivated ? await _model.Decrypt(reporter).ConfigureAwait(false) : await _model.Encrypt(reporter).ConfigureAwait(false);

            var seconds = stats.duration / 1000;
            var message = (_decryptActivated ? "Encryption" : "Decryption") + " Complete!";

            UIEx.ShowNotice(message, "Duration: " + seconds.ToString() + " seconds.");
            //actionButton.Enabled = true;
        }