public string DropdownSearchOption(ColumnDef columnDef)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<input type='hidden' id='P" + PageTemplateId + "_" + columnDef.ColumnName + "' name='P" + PageTemplateId + "_" + columnDef.ColumnName + "' readonly style='width:25px;' />");
            sb.AppendLine("<input type='text' id='P" + PageTemplateId + "_" + columnDef.ColumnName + "_' name='P" + PageTemplateId + "_" + columnDef.ColumnName + "_' readonly style='width:" + columnDef.ElementWidth + "px;' />");

            //OpenLookupWindow
            sb.AppendLine("<a href='javascript:OpenLookupWindow(" + columnDef.PageTemplateId + "," + columnDef.ColumnDefId + ")' style='position:relative;text-decoration:none;top:7px;'><img src='/Images/ToolBar/x24/find.png' /></a>");

            sb.Append("<div id='LookupWindow_" + columnDef.ColumnDefId + "'></div>");

            DocumentReady.AppendLine("$('#LookupWindow_" + columnDef.ColumnDefId + "').kendoWindow({");
            DocumentReady.AppendLine("   height: '700px',");
            DocumentReady.AppendLine("   width: '700px',");
            DocumentReady.AppendLine("   modal: true,");
            DocumentReady.AppendLine("   scrollable: true,");
            DocumentReady.AppendLine("   title: '" + columnDef.DisplayName + "',");
            DocumentReady.AppendLine("   animation: {");
            DocumentReady.AppendLine("		open: {");
            DocumentReady.AppendLine("			duration: 100");
            DocumentReady.AppendLine("		}");
            DocumentReady.AppendLine("   },");
            DocumentReady.AppendLine("   visible: false,");
            DocumentReady.AppendLine("   actions: ['Maximize', 'Close']");
            DocumentReady.AppendLine("   ");
            DocumentReady.AppendLine("});");
            return(sb.ToString());
        }
예제 #2
0
        public string ChangeHistory(ColumnDef columnDef)
        {
            StringBuilder sb         = new StringBuilder();
            string        columnName = columnDef.ColumnName;

            sb.AppendLine("<a href='javascript:OpenChangeHistoryWindow( " + columnDef.PageTemplateId + ")'>View " + columnDef.DisplayName + "</a>");
            sb.Append("<div id='ChangeHistoryWindow" + columnDef.PageTemplateId + "'></div>");

            DocumentReady.AppendLine("$('#ChangeHistoryWindow" + columnDef.PageTemplateId + "').kendoWindow({");
            DocumentReady.AppendLine("   height: '" + columnDef.ElementHeight + "px',");
            DocumentReady.AppendLine("   width: '" + columnDef.ElementWidth + "px',");
            DocumentReady.AppendLine("   modal: true,");
            DocumentReady.AppendLine("   scrollable: true,");
            DocumentReady.AppendLine("   title: '" + columnDef.DisplayName + "',");
            DocumentReady.AppendLine("   animation: {");
            DocumentReady.AppendLine("		open: {");
            DocumentReady.AppendLine("			duration: 100");
            DocumentReady.AppendLine("		}");
            DocumentReady.AppendLine("   },");
            DocumentReady.AppendLine("   visible: false,");
            DocumentReady.AppendLine("   actions: ['Maximize', 'Close']");
            DocumentReady.AppendLine("   ");
            DocumentReady.AppendLine("});");

            return(sb.ToString());
        }
예제 #3
0
        private void WaitUntilDocumentIsReady(object param)
        {
            var targetUrl          = param as string;
            var javaScriptExecutor = _webBrowser.WebDriver as IJavaScriptExecutor;
            var wait = new WebDriverWait(_webBrowser.WebDriver, TimeToWaitPageLoad);

            // Check if document is ready
            var readyCondition = new Func <IWebDriver, bool>(webDriver =>
            {
                var executeScript = javaScriptExecutor?.ExecuteScript(
                    "return (document.readyState == 'complete');");
                var value       = executeScript != null && (bool)executeScript;
                var currentUrl  = GetCurrentUrl();
                var returnValue = value && targetUrl != null && currentUrl != null &&
                                  currentUrl.ToLower().StartsWith(targetUrl.ToLower());
                return(returnValue);
            });

            try
            {
                wait.Until(readyCondition);
                Application.Current.Dispatcher.Invoke(() => { DocumentReady?.Invoke(this, EventArgs.Empty); });
            }
            catch (Exception e)
            {
                Debug.Write($"Exception waitning document ready: {e}");
            }
        }
예제 #4
0
        public string DatePicker(ColumnDef columnDef)
        {
            StringBuilder sb = new StringBuilder();

            int columnWidth = (columnDef.ElementWidth < 10) ? 150 : columnDef.ElementWidth;

            sb.AppendLine("<input id='" + TableName + "_" + columnDef.ColumnName + "' name='" + TableName + "_" + columnDef.ColumnName + "' style='width:" + columnWidth + "px;' />");


            //sb.AppendLine("<div class='form-group'>");
            //sb.AppendLine("   <div class='input-group date' id='" + TableName + "_" + columnDef.ColumnName + "'>");
            //sb.AppendLine("       <input type='text' class='form-control' />");
            //sb.AppendLine("       <span class='input-group-addon'>");
            //sb.AppendLine("           <span class='glyphicon glyphicon-calendar'></span>");
            //sb.AppendLine("       </span>");
            //sb.AppendLine("   </div>");
            //sb.AppendLine("</div>");

            //DocumentReady.AppendLine("$(function () {");
            //DocumentReady.AppendLine("$('#" + TableName + "_" + columnDef.ColumnName + "').datetimepicker();");
            //DocumentReady.AppendLine("});");

            if (columnDef.DatePickerOption == "Date")
            {
                DocumentReady.AppendLine("$('#" + TableName + "_" + columnDef.ColumnName + "').kendoDatePicker({");
            }
            else if (columnDef.DatePickerOption == "DateTime")
            {
                DocumentReady.AppendLine("$('#" + TableName + "_" + columnDef.ColumnName + "').kendoDateTimePicker({");
            }
            else if (columnDef.DatePickerOption == "MonthYear")
            {
                DocumentReady.AppendLine("$('#" + TableName + "_" + columnDef.ColumnName + "').kendoDatePicker({");
                DocumentReady.AppendLine("start: 'year',");
                DocumentReady.AppendLine("depth: 'year',");
                DocumentReady.AppendLine("format: 'MMMM yyyy'");
            }
            else if (columnDef.DatePickerOption == "Year")
            {
                DocumentReady.AppendLine("$('#" + TableName + "_" + columnDef.ColumnName + "').kendoDatePicker({");
                DocumentReady.AppendLine("start: 'year',");
                DocumentReady.AppendLine("depth: 'year',");
                DocumentReady.AppendLine("format: 'yyyy'");
            }
            else
            {
                DocumentReady.AppendLine("$('#" + TableName + "_" + columnDef.ColumnName + "').kendoDatePicker({");
            }

            DocumentReady.AppendLine("});");
            return(sb.ToString());
        }
            public HttpDocument(ref DocumentReady document, ref HttpApi http, HttpContentItem item) : base(document.Data)
            {
                try
                {
                    SetResponse(item, http.GetAllResponseHeaders());
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    SetResponse(item, "");
                }

                item.Data = this.Data;
            }
예제 #6
0
        public string NumericTextbox(ColumnDef columnDef)
        {
            StringBuilder sb = new StringBuilder();

            int columnWidth = (columnDef.ElementWidth < 30) ? 300 : columnDef.ElementWidth;

            sb.AppendLine("<input id='" + TableName + "_" + columnDef.ColumnName + "' name='" + TableName + "_" + columnDef.ColumnName + "'" + ((columnDef.NumberMin > 0) ? " min='" + columnDef.NumberMin + "'" : "") + " " + ((columnDef.NumberMax > 0) ? " max='" + columnDef.NumberMax + "'" : "") + "   style='width:" + columnWidth + "px;' />");

            DocumentReady.AppendLine("$('#" + columnDef.ColumnName + "').kendoNumericTextBox({");
            DocumentReady.AppendLine("	format: '#',");
            DocumentReady.AppendLine("	decimals: "+ columnDef.NumberOfDecimal);
            DocumentReady.AppendLine("});");

            return(sb.ToString());
        }
예제 #7
0
 private void AwesomiumWebControl_DocumentReady(object sender, Awesomium.Core.DocumentReadyEventArgs e)
 {
     try
     {
         if (e.ReadyState == DocumentReadyState.Ready)
         {
             DocumentReady?.Invoke();
         }
     }
     catch (Exception)
     {
         //В некоторых случаях, 1Ска подписывается на событие, хотя явного вызова ДобавитьОбработчик нет,
         //при срабатывании ком обьект просто падает, с ошибкой 0x80020003
     }
 }
예제 #8
0
        public string ImageTextarea(ColumnDef columnDef)
        {
            StringBuilder sb = new StringBuilder();

            int columnWidth  = (columnDef.ElementWidth < 30) ? 500 : columnDef.ElementWidth;
            int columnHeight = (columnDef.ElementHeight < 10) ? 200 : columnDef.ElementHeight;

            sb.AppendLine("<textarea id='" + TableName + "_" + columnDef.ColumnName + "' name='" + TableName + "_" + columnDef.ColumnName + "' style='width:" + columnWidth + "px;height:" + columnHeight + "px;'></textarea>");

            DocumentReady.AppendLine("$('#" + TableName + "_" + columnDef.ColumnName + "').kendoEditor({");
            DocumentReady.AppendLine("      resizable: true,");
            DocumentReady.AppendLine("      tools: [ ]");
            DocumentReady.AppendLine("});");
            DocumentReady.AppendLine("$('.editorToolbarWindow').html('Paste image inside the textarea.'); ");


            return(sb.ToString());
        }
예제 #9
0
 private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     if (e.Error == null && e.Cancelled == false)
     {
         using (StringReader sr = new StringReader(e.Result))
         {
             Result = XDocument.Load(sr);
         }
     }
     else
     {
         Result = null;
     }
     if (DocumentReady != null)
     {
         DocumentReady.Invoke(this, EventArgs.Empty);
     }
 }
예제 #10
0
        public string MultiSelect(ColumnDef columnDef)
        {
            if (columnDef.LookupTable.Length < 2)
            {
                return("Column definition not set properly");
            }

            var sql = "SELECT " + columnDef.ValueField + " AS ValueField, " + columnDef.TextField + " AS TextField FROM " + columnDef.LookupTable + " ORDER BY " + columnDef.OrderField;

            var    pageTemplate = SessionService.PageTemplate(columnDef.PageTemplateId);
            string json         = DataService.GetJsonFromSQL(pageTemplate.DbEntityId, sql);

            if (json.Length < 2)
            {
                json = "[];";
            }

            DocumentReady.AppendLine("var ds" + columnDef.ColumnDefId + " = " + json + ";");
            DocumentReady.AppendLine("");
            DocumentReady.AppendLine("$('#" + TableName + "_" + columnDef.ColumnName + "').kendoMultiSelect({");
            DocumentReady.AppendLine("	placeholder: 'Select "+ columnDef.DisplayName + "',");
            DocumentReady.AppendLine("	dataValueField: 'ValueField',");
            DocumentReady.AppendLine("	dataTextField: 'TextField',");
            DocumentReady.AppendLine("	autoBind: true,");
            DocumentReady.AppendLine("	dataSource: ds"+ columnDef.ColumnDefId + "");
            //DocumentReady.AppendLine("	dataBound: function (e) {");
            //DocumentReady.AppendLine("		var ids = $('#FormName input[id=UserIds_]').val();");
            //DocumentReady.AppendLine("		if (ids.length > 0) {");
            //DocumentReady.AppendLine("			var ray = ids.split(',');");
            //DocumentReady.AppendLine("			$('#UserIds').data('kendoMultiSelect').value(ray);");
            //DocumentReady.AppendLine("		}");
            //DocumentReady.AppendLine("	}");
            DocumentReady.AppendLine("});");


            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<select id='" + TableName + "_" + columnDef.ColumnName + "' name='" + TableName + "_" + columnDef.ColumnName + "' multiple='multiple' style='width:" + columnDef.ElementWidth + "px'></select>");
            sb.AppendLine("");


            return(sb.ToString());
        }
예제 #11
0
        public string FileAttachment(ColumnDef columnDef)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("   <span id='spanDownload" + columnDef.ColumnDefId + "'></span>");

            DocumentReady.AppendLine("			$.ajax({");
            DocumentReady.AppendLine("				url: '"+ SessionService.VirtualDomain + "/FileAttachment/GetAttachedFiles',");
            DocumentReady.AppendLine("				type: 'POST',");
            DocumentReady.AppendLine("				data: { pageTemplateId: "+ columnDef.PageTemplateId + ",columnDefId: " + columnDef.ColumnDefId + ", recordId: $('#InternalId_" + columnDef.PageTemplateId + "').val() },");
            DocumentReady.AppendLine("				async: false,");
            DocumentReady.AppendLine("				dataType: 'text',");
            DocumentReady.AppendLine("				success: function (data) {");
            DocumentReady.AppendLine("					$('#spanDownload"+ columnDef.ColumnDefId + "').html(data);");
            DocumentReady.AppendLine("				}");
            DocumentReady.AppendLine("			}).done(function () {");
            DocumentReady.AppendLine("			});");

            return(sb.ToString());
        }
예제 #12
0
        public string Note(ColumnDef columnDef)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("   <span id='spanNote" + columnDef.ColumnDefId + "' style='width:" + columnDef.ElementWidth + "px;'></span>");

            DocumentReady.AppendLine("			$.ajax({");
            DocumentReady.AppendLine("				url: '"+ SessionService.VirtualDomain + "/Note/GetPartialNote',");
            DocumentReady.AppendLine("				type: 'POST',");
            DocumentReady.AppendLine("				data: { columnDefId: "+ columnDef.ColumnDefId + ", recordId: $('#InternalId_" + columnDef.PageTemplateId + "').val() },");
            DocumentReady.AppendLine("				async: false,");
            DocumentReady.AppendLine("				dataType: 'text',");
            DocumentReady.AppendLine("				success: function (data) {");
            DocumentReady.AppendLine("					$('#spanNote"+ columnDef.ColumnDefId + "').html(data);");
            DocumentReady.AppendLine("				}");
            DocumentReady.AppendLine("			}).done(function () {");
            DocumentReady.AppendLine("			});");

            return(sb.ToString());
        }
예제 #13
0
        public string DropdownSimple(ColumnDef columnDef)
        {
            StringBuilder sb = new StringBuilder();

            int columnWidth = (columnDef.ElementWidth < 30) ? 300 : columnDef.ElementWidth;

            sb.AppendLine("<input type='text' id='" + TableName + "_" + columnDef.ColumnName + "' name='" + TableName + "_" + columnDef.ColumnName + "' style='width:" + columnWidth + "px;' />");

            DocumentReady.AppendLine("$('#Form_" + columnDef.PageTemplateId + " input[id=" + TableName + "_" + columnDef.ColumnName + "] ').kendoDropDownList({");
            DocumentReady.AppendLine("   dataValueField: 'ValueField',");
            DocumentReady.AppendLine("   dataTextField: 'TextField',");
            DocumentReady.AppendLine("   dataSource: {");
            DocumentReady.AppendLine("      transport: {");
            DocumentReady.AppendLine("			read: {");
            DocumentReady.AppendLine("				dataType: 'json',");
            DocumentReady.AppendLine("				url: '/Page/GetOptionsByColumnDefId?pageTemplateId="+ columnDef.PageTemplateId + "&columnDefId=" + columnDef.ColumnDefId + "',");
            DocumentReady.AppendLine("			}");
            DocumentReady.AppendLine("      }");
            DocumentReady.AppendLine("   }");
            DocumentReady.AppendLine("});");
            return(sb.ToString());
        }
예제 #14
0
        private async Task RaiseDocumentReady(KdbxDocument document, IDatabaseCandidate candidate)
        {
            DebugHelper.Assert(HasGoodHeader);
            if (!HasGoodHeader)
            {
                throw new InvalidOperationException("Document cannot be ready, because the KdbxReader does not have good HeaderData.");
            }

            IDatabasePersistenceService persistenceService;

            if (IsSampleFile)
            {
                persistenceService = new DummyPersistenceService();
            }
            else
            {
                IKdbxWriter writer = this.kdbxReader.GetWriter();
                persistenceService = new DefaultFilePersistenceService(
                    writer,
                    writer,
                    candidate,
                    this.syncContext,
                    await candidate.File.CheckWritableAsync()
                    );
            }

            DocumentReady?.Invoke(
                this,
                new DocumentReadyEventArgs(
                    document,
                    candidate,
                    persistenceService,
                    this.kdbxReader.HeaderData.GenerateRng(),
                    this.keyChangeVmFactory
                    )
                );
        }
예제 #15
0
 private WebBrowserExtensionWpf(WebBrowser webBrowser)
 {
     Browser         = webBrowser;
     Browser.Loaded += (sender, args) => { DocumentReady?.Invoke(this, args); };
 }
예제 #16
0
 public HttpDocument(ref DocumentReady document, ref HttpApi http, HttpContentItem item) : base(document.Data)
 {
     SetResponse(item, http.GetAllResponseHeaders());
     item.Data = this.Data;
 }
예제 #17
0
        public string ParentTable(ColumnDef columnDef)
        {
            StringBuilder sb         = new StringBuilder();
            string        columnName = columnDef.ColumnName;

            int columnWidth  = (columnDef.ElementWidth < 30) ? 300 : columnDef.ElementWidth;
            int columnHeight = (columnDef.ElementHeight < 10) ? 200 : columnDef.ElementHeight;

            // get parent column and value  SELECT
            var parentTemplate = SessionService.PageTemplate(columnDef.PageTemplateId);
            var childTemplate  = SessionService.PageTemplate(columnDef.ChildTemplateId);

            sb.Append("<div id='gridChild" + columnDef.ColumnDefId + "' style='width:" + columnDef.ElementWidth + "px;'></div>");
            sb.Append("<input type='button' value='Add' onclick='Add" + columnDef.ColumnDefId + "(0)' />");
            sb.Append("<input type='button' value='Edit' onclick='Edit" + columnDef.ColumnDefId + "()' />");
            sb.Append("<input type='button' value='Delete' onclick='Delete" + columnDef.ColumnDefId + "()' />");


            DocumentReady.AppendLine("$(\"#gridChild" + columnDef.ColumnDefId + "\").kendoGrid({");
            DocumentReady.AppendLine("   dataSource: {");
            DocumentReady.AppendLine("		type: \"json\",");
            DocumentReady.AppendLine("		transport: {");
            DocumentReady.AppendLine("			read: {");
            DocumentReady.AppendLine("				url: \"/Page/GetChildData?childPageTemplateId="+ childTemplate.PageTemplateId + "&recordId=\" + $('#InternalId_" + parentTemplate.PageTemplateId + "').val() + \"&parentColumnDefId=" + columnDef.ColumnDefId + "\",");
            DocumentReady.AppendLine("				dataType: \"json\",");
            DocumentReady.AppendLine("				type: \"POST\",");
            DocumentReady.AppendLine("				contentType: \"application/json; charset=utf-8\"");
            DocumentReady.AppendLine("			},");
            DocumentReady.AppendLine("		},");
            DocumentReady.AppendLine("	},");
            DocumentReady.AppendLine("   selectable: \"row\",");
            DocumentReady.AppendLine("   height: " + columnDef.ElementHeight + ",");
            DocumentReady.AppendLine("   sortable: true,");
            DocumentReady.AppendLine("   pageable: false,");
            DocumentReady.AppendLine("   columns: [ ");

            if (columnDef.TextField.Contains(","))
            {
                string[] words = columnDef.TextField.Split(new char[] { ',' });
                foreach (string word in words)
                {
                    DocumentReady.AppendLine("		{ field: \""+ word + "\", title: \"" + word + "\" },");
                }
            }
            else
            {
                DocumentReady.AppendLine("		{ field: \""+ columnDef.TextField + "\", title: \"" + columnDef.TextField + "\" }");
            }

            DocumentReady.AppendLine("   ]");
            DocumentReady.AppendLine("   ");
            DocumentReady.AppendLine("});");

            DocumentReady.AppendLine("$('#window" + columnDef.ColumnDefId + "').kendoWindow({");
            DocumentReady.AppendLine("	modal: true,");
            DocumentReady.AppendLine("	scrollable: true,");
            DocumentReady.AppendLine("	title: '"+ childTemplate.TemplateName + "',");
            DocumentReady.AppendLine("	animation: {");
            DocumentReady.AppendLine("		open: {");
            DocumentReady.AppendLine("			duration: 100");
            DocumentReady.AppendLine("		}");
            DocumentReady.AppendLine("	},");
            DocumentReady.AppendLine("	visible: false,");
            DocumentReady.AppendLine("	actions: ['Maximize', 'Close'],");
            DocumentReady.AppendLine("	activate: function () {");
            DocumentReady.AppendLine("		//$('#NewTemplateName').focus();");
            DocumentReady.AppendLine("	}");
            DocumentReady.AppendLine("});");


            Functions.AppendLine("function Add" + columnDef.ColumnDefId + "() {");
            Functions.AppendLine("		BindFormData("+ childTemplate.PageTemplateId + ", 0);");
            Functions.AppendLine("		$('#window"+ columnDef.ColumnDefId + "').data('kendoWindow').open().center();");
            Functions.AppendLine("	}");

            Functions.AppendLine("	function Edit"+ columnDef.ColumnDefId + "() {");
            Functions.AppendLine("		var grid = $('#gridChild"+ columnDef.ColumnDefId + "').data('kendoGrid');");
            Functions.AppendLine("		var dataItem = grid.dataItem(grid.select());");
            Functions.AppendLine("		BindFormData("+ childTemplate.PageTemplateId + ", dataItem." + childTemplate.PrimaryKey + ");");
            Functions.AppendLine("		$('#window"+ columnDef.ColumnDefId + "').data('kendoWindow').open().center();");
            Functions.AppendLine("	}");

            Functions.AppendLine("	function Delete"+ columnDef.ColumnDefId + "() {");
            Functions.AppendLine("		ConfirmMessage('Warning', 'Delete record?');");
            Functions.AppendLine("		$('#dialogYesButton').click(function () {");
            Functions.AppendLine("			var grid = $('#gridChild"+ columnDef.ColumnDefId + "').data('kendoGrid');");
            Functions.AppendLine("			var dataItem = grid.dataItem(grid.select());");
            Functions.AppendLine("			$.ajax({");
            Functions.AppendLine("				url: '"+ SessionService.VirtualDomain + "/Page/DeleteChildTableRecord',");
            Functions.AppendLine("				type: 'POST',");
            Functions.AppendLine("				data: { pageTemplateId: "+ childTemplate.PageTemplateId + ", recordId: dataItem." + childTemplate.PrimaryKey + " },");
            Functions.AppendLine("				async: false,");
            Functions.AppendLine("				dataType: 'text',");
            Functions.AppendLine("				success: function (data) {");
            Functions.AppendLine("					$('#gridChild"+ columnDef.ColumnDefId + "').data('kendoGrid').dataSource.read();");
            Functions.AppendLine("				}");
            Functions.AppendLine("			}).done(function () {");
            Functions.AppendLine("				$('#dialogYesNo').data('kendoWindow').close();");
            Functions.AppendLine("			});");
            Functions.AppendLine("		})");

            Functions.AppendLine("		$('#dialogNoButton').click(function () {");
            Functions.AppendLine("			$('#dialogYesNo').data('kendoWindow').close();");
            Functions.AppendLine("		})");
            Functions.AppendLine("	}");

            Functions.AppendLine("	function Save"+ columnDef.ColumnDefId + "() {");
            Functions.AppendLine("		var parentId = $('#InternalId_"+ parentTemplate.PageTemplateId + "').val();");
            Functions.AppendLine("		$('#Form_"+ childTemplate.PageTemplateId + " input[id=" + parentTemplate.PrimaryKey + "]').val(parentId);");
            Functions.AppendLine("		var json = ToJsonString('Form_"+ childTemplate.PageTemplateId + "');");
            Functions.AppendLine("		$.ajax({");
            Functions.AppendLine("			url: '"+ SessionService.VirtualDomain + "/Page/SaveFormData',");
            Functions.AppendLine("			type: 'POST',");
            Functions.AppendLine("			data: { pageTemplateId: "+ childTemplate.PageTemplateId + ", json: json, oldJson: '' },");
            Functions.AppendLine("			async: false,");
            Functions.AppendLine("			dataType: 'json',");
            Functions.AppendLine("			success: function (data) {");
            Functions.AppendLine("				$('#gridChild"+ columnDef.ColumnDefId + "').data('kendoGrid').dataSource.read();");
            Functions.AppendLine("			}");
            Functions.AppendLine("		}).done(function () {");
            Functions.AppendLine("			 $('#window"+ columnDef.ColumnDefId + "').data('kendoWindow').close();");
            Functions.AppendLine("		});");
            Functions.AppendLine("	}");

            AfterForm.AppendLine("<div id='window" + columnDef.ColumnDefId + "'>");
            AfterForm.AppendLine("	<form id='Form_"+ childTemplate.PageTemplateId + "'>");
            AfterForm.AppendLine("		<input type='button' value='Save' onclick='Save"+ columnDef.ColumnDefId + "()' />");
            AfterForm.AppendLine(SessionService.FormLayout(childTemplate.PageTemplateId, true));
            AfterForm.AppendLine("	</form>");
            AfterForm.AppendLine("</div>");

            return(sb.ToString());
        }
예제 #18
0
 private WebBrowserExtensionWinForm(WebBrowser webBrowser)
 {
     Browser = webBrowser;
     Browser.DocumentCompleted += (sender, args) => { DocumentReady?.Invoke(this, args); };
 }
예제 #19
0
        /// <summary>
        /// Uses provided options to generate a database file.
        /// </summary>
        protected override async Task HandleCredentialsAsync(string confirmedPassword, ITestableFile chosenKeyFile)
        {
            CancellationTokenSource cts = new CancellationTokenSource();

            IKdbxWriter writer = this.writerFactory.Assemble(
                confirmedPassword,
                chosenKeyFile,
                Settings.Cipher,
                Settings.GetKdfParameters()
                );
            IRandomNumberGenerator rng = writer.HeaderData.GenerateRng();

            KdbxDocument newDocument = new KdbxDocument(new KdbxMetadata("PassKeep Database"));

            if (!CreateEmpty)
            {
                IList <IKeePassGroup> groups = new List <IKeePassGroup>
                {
                    new KdbxGroup(newDocument.Root.DatabaseGroup),
                    new KdbxGroup(newDocument.Root.DatabaseGroup),
                    new KdbxGroup(newDocument.Root.DatabaseGroup),
                    new KdbxGroup(newDocument.Root.DatabaseGroup),
                    new KdbxGroup(newDocument.Root.DatabaseGroup),
                    new KdbxGroup(newDocument.Root.DatabaseGroup)
                };

                groups[0].Title.ClearValue = "General";
                groups[1].Title.ClearValue = "Windows";
                groups[2].Title.ClearValue = "Network";
                groups[3].Title.ClearValue = "Internet";
                groups[4].Title.ClearValue = "eMail";
                groups[5].Title.ClearValue = "Homebanking";

                groups[0].IconID = 48;
                groups[1].IconID = 38;
                groups[2].IconID = 3;
                groups[3].IconID = 1;
                groups[4].IconID = 19;
                groups[5].IconID = 37;

                foreach (IKeePassGroup group in groups)
                {
                    newDocument.Root.DatabaseGroup.Children.Add(group);
                }

                IList <IKeePassEntry> entries = new List <IKeePassEntry>
                {
                    new KdbxEntry(newDocument.Root.DatabaseGroup, rng, newDocument.Metadata),
                    new KdbxEntry(newDocument.Root.DatabaseGroup, rng, newDocument.Metadata)
                };

                entries[0].Title.ClearValue = "Sample Entry";
                entries[1].Title.ClearValue = "Sample Entry #2";

                entries[0].UserName.ClearValue = "User Name";
                entries[1].UserName.ClearValue = "Michael321";

                entries[0].Password.ClearValue = "Password";
                entries[1].Password.ClearValue = "12345";

                entries[0].Url.ClearValue = "http://keepass.info/";
                entries[1].Url.ClearValue = "http://keepass.info/help/kb/testform.html";

                entries[0].Notes.ClearValue = "Notes";

                foreach (IKeePassEntry entry in entries)
                {
                    newDocument.Root.DatabaseGroup.Children.Add(entry);
                }
            }

            using (IRandomAccessStream stream = await File.AsIStorageFile.OpenAsync(FileAccessMode.ReadWrite))
            {
                Task <bool> writeTask = writer.WriteAsync(stream, newDocument, cts.Token);
                this.taskNotificationService.PushOperation(writeTask, cts, AsyncOperationType.DatabaseEncryption);

                if (await writeTask)
                {
                    this.futureAccessList.Add(File, File.AsIStorageItem.Name);

                    IDatabaseCandidate candidate = await this.candidateFactory.AssembleAsync(File);

                    IDatabasePersistenceService persistenceService = new DefaultFilePersistenceService(
                        writer,
                        writer,
                        candidate,
                        this.syncContext,
                        true);

                    DocumentReady?.Invoke(
                        this,
                        new DocumentReadyEventArgs(
                            newDocument,
                            candidate,
                            persistenceService,
                            writer.HeaderData.GenerateRng(),
                            this.keyChangeVmFactory
                            )
                        );
                }
            }
        }