示例#1
0
        /// <summary>
        /// Sauve le fichier ouvert sous un autre nom.
        /// </summary>
        /// <param name="filePath">L'url du nouveau fichier</param>
        /// <param name="overwrite"></param>
        /// <returns>
        /// OperationState.CONTINUE si l'opération a réussi
        /// OperationState.STOP sinon
        /// </returns>
        public OperationState SaveAs(String filePath)
        {
            bool result = false;

            try
            {
                if (System.IO.File.Exists(filePath) && DocumentUrl != null && DocumentUrl.Equals(filePath))
                {
                    result = this.Office.Save();
                }
                else
                {
                    result = this.Office.SaveAs(filePath);
                }
                if (result)
                {
                    DocumentUrl = this.Office.GetDocumentFullName();
                    return(OperationState.CONTINUE);
                }
            }
            catch (Exception)
            {
                return(OperationState.STOP);
            }
            return(OperationState.STOP);
        }
示例#2
0
        public DocumentUrl GetAgreementDocumentUrl(int?creditDataId, string agreementId)
        {
            var request = new RestRequest($"{_apiEndpointVer}/agreements/{agreementId}/combinedDocument/url", Method.GET);

            request.AddHeader("Content-Type", "application/json");
            request.AddHeader("Authorization", $"Bearer {AccessToken}");
            var         result = _restClient.Execute(request);
            DocumentUrl agreementDocumentUrl = JsonConvert.DeserializeObject <DocumentUrl>(result.Content);

            return(agreementDocumentUrl);
        }
        private void UpdateAddressBar(DocumentUrl documentUrl)
        {
            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.Invoke(() => UpdateAddressBar(documentUrl));
                return;
            }

            CategoryButton.Content = documentUrl.Category;
            NameButton.Content     = documentUrl.Name;
        }
        private async Task <bool> Navigate(DocumentUrl documentUrl)
        {
            SetMessage("Loading...");
            try
            {
                UpdateAddressBar(documentUrl);

                var options = new Documentation.DocumentOptions();
                switch (documentUrl.Category.ToUpperInvariant())
                {
                case "HELP":
                    if (_topics.TryGetValue(documentUrl.Name, out var generator))
                    {
                        _document = null;
                        Display(generator());
                        return(true);
                    }
                    break;

                case "ITEMTYPE":
                    await _metadata.ReloadTask();

                    if (_metadata.ItemTypeByName(documentUrl.Name, out var itemType))
                    {
                        await Task.WhenAll(_metadata.GetClassPaths(itemType).ToTask(), _metadata.GetProperties(itemType).ToTask());

                        Display(Documentation.Document.FromItemType(itemType, options));
                        return(true);
                    }
                    break;

                case "METHOD":
                    await _metadata.ReloadTask();

                    var method = _metadata.Methods.FirstOrDefault(m => string.Equals(m.KeyedName, documentUrl.Name, StringComparison.OrdinalIgnoreCase));
                    if (method != null)
                    {
                        Display(Documentation.Document.FromMethod(method, options));
                        return(true);
                    }
                    break;
                }
                SetMessage("Can't load document");
            }
            catch (Exception ex)
            {
                SetMessage("Can't load document\r\n" + ex.ToString());
            }

            return(false);
        }
        public bool TryNavigate(string category, string name)
        {
            while (_history.Count > Math.Max(_historyIndex + 1, 0))
            {
                _history.RemoveAt(_history.Count - 1);
            }
            var url = new DocumentUrl(category, name);

            if (_historyIndex >= 0 && _history[_historyIndex].Equals(url))
            {
                return(false);
            }

            _history.Add(url);
            SetHistoryIndex(_historyIndex + 1);

            Navigate(url);
            return(true);
        }
示例#6
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // ReSharper disable NonReadonlyMemberInGetHashCode
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         hashCode = hashCode * 59 + DocumentType.GetHashCode();
         if (DocumentContent != null)
         {
             hashCode = hashCode * 59 + DocumentContent.GetHashCode();
         }
         if (DocumentUrl != null)
         {
             hashCode = hashCode * 59 + DocumentUrl.GetHashCode();
         }
         if (Test != null)
         {
             hashCode = hashCode * 59 + Test.GetHashCode();
         }
         if (Pipeline != null)
         {
             hashCode = hashCode * 59 + Pipeline.GetHashCode();
         }
         if (Strict != null)
         {
             hashCode = hashCode * 59 + Strict.GetHashCode();
         }
         if (IgnoreResourceErrors != null)
         {
             hashCode = hashCode * 59 + IgnoreResourceErrors.GetHashCode();
         }
         if (IgnoreConsoleMessages != null)
         {
             hashCode = hashCode * 59 + IgnoreConsoleMessages.GetHashCode();
         }
         if (Tag != null)
         {
             hashCode = hashCode * 59 + Tag.GetHashCode();
         }
         if (Help != null)
         {
             hashCode = hashCode * 59 + Help.GetHashCode();
         }
         if (Javascript != null)
         {
             hashCode = hashCode * 59 + Javascript.GetHashCode();
         }
         if (Referrer != null)
         {
             hashCode = hashCode * 59 + Referrer.GetHashCode();
         }
         if (CallbackUrl != null)
         {
             hashCode = hashCode * 59 + CallbackUrl.GetHashCode();
         }
         if (HostedDownloadLimit != null)
         {
             hashCode = hashCode * 59 + HostedDownloadLimit.GetHashCode();
         }
         if (HostedExpiresAt != null)
         {
             hashCode = hashCode * 59 + HostedExpiresAt.GetHashCode();
         }
         if (PrinceOptions != null)
         {
             hashCode = hashCode * 59 + PrinceOptions.GetHashCode();
         }
         // ReSharper restore NonReadonlyMemberInGetHashCode
         return(hashCode);
     }
 }
示例#7
0
        /// <summary>
        /// Returns true if Doc instances are equal
        /// </summary>
        /// <param name="input">Instance of Doc to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Doc input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                     ) &&
                 (
                     DocumentType == input.DocumentType ||
                     (DocumentType.Equals(input.DocumentType))
                 ) &&
                 (
                     DocumentContent == input.DocumentContent ||
                     (DocumentContent != null &&
                      DocumentContent.Equals(input.DocumentContent))
                 ) &&
                 (
                     DocumentUrl == input.DocumentUrl ||
                     (DocumentUrl != null &&
                      DocumentUrl.Equals(input.DocumentUrl))
                 ) &&
                 (
                     Test == input.Test ||
                     (Test != null &&
                      Test.Equals(input.Test))
                 ) &&
                 (
                     Pipeline == input.Pipeline ||
                     (Pipeline != null &&
                      Pipeline.Equals(input.Pipeline))
                 ) &&
                 (
                     Strict == input.Strict ||
                     (Strict != null &&
                      Strict.Equals(input.Strict))
                 ) &&
                 (
                     IgnoreResourceErrors == input.IgnoreResourceErrors ||
                     (IgnoreResourceErrors != null &&
                      IgnoreResourceErrors.Equals(input.IgnoreResourceErrors))
                 ) &&
                 (
                     IgnoreConsoleMessages == input.IgnoreConsoleMessages ||
                     (IgnoreConsoleMessages != null &&
                      IgnoreConsoleMessages.Equals(input.IgnoreConsoleMessages))
                 ) &&
                 (
                     Tag == input.Tag ||
                     (Tag != null &&
                      Tag.Equals(input.Tag))
                 ) &&
                 (
                     Help == input.Help ||
                     (Help != null &&
                      Help.Equals(input.Help))
                 ) &&
                 (
                     Javascript == input.Javascript ||
                     (Javascript != null &&
                      Javascript.Equals(input.Javascript))
                 ) &&
                 (
                     Referrer == input.Referrer ||
                     (Referrer != null &&
                      Referrer.Equals(input.Referrer))
                 ) &&
                 (
                     CallbackUrl == input.CallbackUrl ||
                     (CallbackUrl != null &&
                      CallbackUrl.Equals(input.CallbackUrl))
                 ) &&
                 (
                     HostedDownloadLimit == input.HostedDownloadLimit ||
                     (HostedDownloadLimit != null &&
                      HostedDownloadLimit.Equals(input.HostedDownloadLimit))
                 ) &&
                 (
                     HostedExpiresAt == input.HostedExpiresAt ||
                     (HostedExpiresAt != null &&
                      HostedExpiresAt.Equals(input.HostedExpiresAt))
                 ) &&
                 (
                     ReferenceEquals(PrinceOptions, input.PrinceOptions) ||
                     (PrinceOptions != null &&
                      PrinceOptions.Equals(input.PrinceOptions))
                 ));
        }