public ObjectExplorerPresenter(IObjectExplorerView view)
        {
            nodesForItem = new Dictionary <ObjectExplorerItem, List <ITreeNode> >();

            View = view;

            view.Loaded          += View_Load;
            view.NodeMouseClick  += View_NodeMouseClick;
            view.NodeAfterSelect += View_NodeAfterSelect;

            Container = ContainerDelivery.GetContainer();

            TreeNodeFactory = Container.Resolve <ITreeNodeFactory>();
            ObjectExplorerRepositoryFactory = Container.Resolve <IObjectExplorerRepositoryFactory>();
            MenuFactory = Container.Resolve <IMenuFactory>();
            CommandBus  = Container.Resolve <ICommandBus>();

            documentsController = Container.Resolve <IDocumentsController>();
            documentsController.DocumentActivationChanged += DocumentsController_DocumentActivationChanged;

            documentConnector = Container.Resolve <IDocumentConnector>();
            documentConnector.ConnectingStarted  += DocumentConnector_ConnectingStarted;
            documentConnector.ConnectingFinished += DocumentConnector_ConnectingFinished;
            documentConnector.Disconnected       += DocumentConnector_Disconnected;
        }
 public MainModule(IDocumentsController documentsController)
 {
     Get["/isAlive"] = _ => true;
     Post["/index"]  = _ =>
     {
         documentsController.Index(Request.Body.AsString());
         return("Ok");
     };
     Post["/search"] = _ => documentsController.Query(Request.Body.AsString());
 }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        internal static void CommandMenuInit()
        {
            BootStrapper.RegisterComponents();
            BootStrapper.RegisterCommandHandlers();

            var container = ContainerDelivery.GetContainer();

            pluginFormProvider = container.Resolve <IPluginFormProvider>();
            commandBus         = container.Resolve <ICommandBus>();
            documentController = container.Resolve <IDocumentsController>();

            PluginBase.SetCommand(0, "Object explorer", ToggleObjectExplorer);
            PluginBase.SetCommand(1, "Output", ToggleOutput);
            PluginBase.SetCommand(2, "Execute", Execute);
        }
Пример #4
0
        static void Main(string[] args)
        {
            var logger = new Serilog.LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.ColoredConsole()
                         .CreateLogger();

            Log.Logger = logger;
            OAuthToken token = null;


            IdfyRestClientClient client = new IdfyRestClientClient(Credentials.ClientId, Credentials.ClienttSecret);

            try
            {
                token = client.Auth.Authorize(scopes: new List <OAuthScope>()
                {
                    OAuthScope.DOCUMENT_FILE, OAuthScope.DOCUMENT_READ, OAuthScope.DOCUMENT_WRITE
                });
            }
            catch (OAuthProviderException e)
            {
                Console.WriteLine(e);
                Console.ReadLine();
                return;
            }

            IDocumentsController documents = client.Documents;

            CreateDocumentRequestWrapper request = new CreateDocumentRequestWrapper
            {
                Title       = "Test document",
                Description = "This is an important document",
                ExternalId  = Guid.NewGuid().ToString(),
                DataToSign  = new DataToSign
                {
                    Base64Content = Convert.ToBase64String(File.ReadAllBytes("test.pdf")),
                    FileName      = "test.pdf",
                    ConvertToPDF  = false,
                    Packaging     = new Packaging()
                    {
                        PadesSettings = new PadesSettings()
                        {
                            PrimaryLanguage   = PrimaryLanguage.NO,
                            SecondaryLanguage = SecondaryLanguage.EN
                        },
                        SignaturePackageFormats = new List <SignaturePackageFormat>()
                        {
                            SignaturePackageFormat.PADES
                        }
                    }
                },
                ContactDetails = new ContactDetails
                {
                    Email = "*****@*****.**",
                    Url   = "https://idfy.io"
                },
                Signers  = new List <SignerWrapper>(),
                Advanced = new Advanced
                {
                    Tags = new List <string> {
                        "develop", "fun_with_documents"
                    },
                    Attachments             = 0,
                    RequiredSignatures      = 0,
                    GetSocialSecurityNumber = false,
                    TimeToLive = new TimeToLive
                    {
                        Deadline         = DateTime.Now.AddDays(1),
                        DeleteAfterHours = 1
                    },
                }
            };

            SignerWrapper signer = new SignerWrapper
            {
                ExternalSignerId = Guid.NewGuid().ToString(),
                RedirectSettings = new RedirectSettings(),
                SignatureType    = new SignatureType(),
                Ui         = new UI(),
                Order      = 0,
                Required   = false,
                SignerInfo = new SignerInfo()
                {
                    FirstName = "Rune",
                    LastName  = "Synnevåg",
                    Email     = "*****@*****.**",
                    Mobile    = new Mobile()
                    {
                        CountryCode = "+47", Number = "99716935",
                    },
                },
                Notifications = new Notifications()
                {
                    Setup = new Setup()
                    {
                        SignatureReceipt = SignatureReceipt.SENDEMAIL,
                        Request          = Request.SENDBOTH,
                        Reminder         = Reminder.OFF,
                        FinalReceipt     = FinalReceipt.OFF,
                        Expired          = Expired.OFF,
                        Canceled         = Canceled.OFF,
                    },
                },
            };

            signer.RedirectSettings.RedirectMode = RedirectMode.DONOT_REDIRECT;
            signer.SignatureType.Mechanism       = Mechanism.PKISIGNATURE;
            signer.SignatureType.OnEacceptUseHandWrittenSignature = false;
            signer.Ui.Dialogs = new Dialogs
            {
                Before = new DialogBefore
                {
                    UseCheckBox = false,
                    Title       = "Info",
                    Message     = "Please read the contract on the next pages carefully. Pay some extra attention to paragraph 5."
                }
            };
            signer.Ui.Language = Language157.EN;
            signer.Ui.Styling  = new SignatureStyling
            {
                ColorTheme = ColorTheme.PINK,
                Spinner    = Spinner.CUBES
            };
            request.Signers.Add(signer);



            try
            {
                client.Auth.UpdateAccessToken(token);
                var result = documents.DocumentsCreateAsync(request).Result;

                Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result, Formatting.Indented));

                Console.ReadLine();

                var signedDocument = documents.DocumentsGetAsync(result.DocumentId.Value).Result;

                Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(signedDocument, Formatting.Indented));
            }
            catch (APIException e)
            {
                Console.WriteLine(e);
            };



            Console.ReadLine();
        }
Пример #5
0
 public ConnectCommandHandler()
 {
     container           = ContainerDelivery.GetContainer();
     documentsController = container.Resolve <IDocumentsController>();
     documentConnector   = container.Resolve <IDocumentConnector>();
 }