private void OnCleared()
 {
     if (SignatureCommand != null && SignatureCommand.CanExecute(null))
     {
         SignatureCommand.Execute(null);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Will generate a signature file for the file that you provide and save it at your desired location. If save location isn't specified then it will save it to the same location as the file.
        /// </summary>
        /// <returns>The single signature file.</returns>
        /// <param name="oldFilePath">Outdated file path.</param>
        /// <param name="saveLocation">Override save location.</param>

        public string generateSignatureFile(string oldFilePath, string saveLocation = "")
        {
            curProcessDone = false;
            currentProcess = "Generating Signature File for " + Path.GetFileName(oldFilePath);
            try
            {
                if (string.IsNullOrEmpty(saveLocation) == true)                                                 //if no save location specified make one
                {
                    string[] fileInfo = octodiffFilePathInfo(oldFilePath);
                    saveLocation = fileInfo[0];
                }
                saveLocation = saveLocation.Trim();
                if (Path.GetExtension(saveLocation) != ".sig")                                                  //add correct file ending (if applicable)
                {
                    saveLocation = saveLocation + ".sig";
                }
                //Usage: Octodiff.exe signature <basis-file> [<signature-file>] [<options>]
                string []        commands = { oldFilePath, saveLocation };                                      //Add correct arguments for signature command
                SignatureCommand command  = new SignatureCommand();
                command.Execute(commands);                                                                      //make the signature file
            }
            catch (Exception ex)
            {
                currentProcess   = "";
                currentException = ex.Message;
                return(ex.Message);
            }
            currentProcess = "";
            curProcessDone = true;
            return("Success");
        }
        private async void OnStrokeCompleted()
        {
            if (SignatureCommand != null && SignatureCommand.CanExecute(null))
            {
                await Task.Delay(300);

                var strokes = JsonSerializer.Serialize(this.Strokes);
                var stream  = await this.GetImageStreamAsync(SignatureImageFormat.Png);

                SignatureCommand.Execute(new Tuple <string, Stream>(strokes, stream));
            }
        }