public PrintPageEventArgs(Graphics graphics, Rectangle marginBounds, Rectangle pageBounds, PageSettings pageSettings) { Graphics = graphics; MarginBounds = marginBounds; PageBounds = pageBounds; PageSettings = pageSettings; }
// Constructor. public PrintPageEventArgs(Graphics graphics, Rectangle marginBounds, Rectangle pageBounds, PageSettings pageSettings) { this.cancel = false; this.hasMorePages = false; this.graphics = graphics; this.marginBounds = marginBounds; this.pageBounds = pageBounds; this.pageSettings = pageSettings; }
private ReportPrintDocument(Report report) { // Set the page settings to the default defined in the report ReportPageSettings reportPageSettings = report.GetDefaultPageSettings(); // The page settings object will use the default printer unless // PageSettings.PrinterSettings is changed. This assumes there // is a default printer. m_pageSettings = new PageSettings(); m_pageSettings.PaperSize = reportPageSettings.PaperSize; m_pageSettings.Margins = reportPageSettings.Margins; }
internal PrintPageEventArgs(PageSettings pageSettings) { this.cancel = false; this.hasMorePages = false; this.graphics = null; this.pageBounds = pageSettings.Bounds; Margins margins = pageSettings.Margins; this.marginBounds = new Rectangle (margins.Left, margins.Top, pageBounds.Width - margins.Left - margins.Right, pageBounds.Height - margins.Top - margins.Bottom); this.pageSettings = pageSettings; }
private void okButton_Click(object sender, EventArgs e) { PageSettings settings= new PageSettings(); settings.paper_type = WbContext.get_paper_sizes()[paperSizeCombo.SelectedIndex].name; settings.margin_top = double.Parse(topMarginText.Text); settings.margin_bottom= double.Parse(bottomMarginText.Text); settings.margin_left= double.Parse(leftMarginText.Text); settings.margin_right= double.Parse(rightMarginText.Text); if (landscapeRadio.Checked) settings.orientation = "landscape"; else settings.orientation = "portrait"; WbContext.set_page_settings(settings); Close(); }
public System.Drawing.Graphics CreateMeasurementGraphics(PageSettings pageSettings) {}
public System.IntPtr GetHdevmode(PageSettings pageSettings) {}
private void LoadSettings() { pageID = WebUtils.ParseInt32FromQueryString("pageid", -1); moduleId = WebUtils.ParseInt32FromQueryString("mid", -1); categoryId = WebUtils.ParseInt32FromQueryString("cat", categoryId); siteSettings = CacheHelper.GetCurrentSiteSettings(); // newer implementation combines params as p=pageid~moduleid~categoryid string f = WebUtils.ParseStringFromQueryString("p", string.Empty); if ((f.Length > 0) && (f.Contains("~"))) { List <string> parms = f.SplitOnCharAndTrim('~'); if (parms.Count >= 1) { int.TryParse(parms[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out pageID); } if (parms.Count >= 2) { int.TryParse(parms[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out moduleId); } if (parms.Count >= 3) { int.TryParse(parms[2], NumberStyles.Integer, CultureInfo.InvariantCulture, out categoryId); } } securityBypassGuid = WebUtils.ParseGuidFromQueryString("g", securityBypassGuid); attachmentBaseUrl = SiteUtils.GetFileAttachmentUploadPath(); pageSettings = CacheHelper.GetPage(pageID); module = GetModule(); if ((moduleId == -1) || (module == null)) { return; } bool bypassPageSecurity = false; if ((securityBypassGuid != Guid.Empty) && (securityBypassGuid == WebConfigSettings.InternalFeedSecurityBypassKey)) { bypassPageSecurity = true; } if ( (bypassPageSecurity) || (WebUser.IsInRoles(pageSettings.AuthorizedRoles)) || (WebUser.IsInRoles(module.ViewRoles)) ) { canView = true; } if (!canView) { return; } if (WebConfigSettings.UseFoldersInsteadOfHostnamesForMultipleSites) { navigationSiteRoot = SiteUtils.GetNavigationSiteRoot(); blogBaseUrl = navigationSiteRoot; imageSiteRoot = WebUtils.GetSiteRoot(); cssBaseUrl = imageSiteRoot; } else { navigationSiteRoot = WebUtils.GetHostRoot(); blogBaseUrl = SiteUtils.GetNavigationSiteRoot(); imageSiteRoot = navigationSiteRoot; cssBaseUrl = WebUtils.GetSiteRoot(); } moduleSettings = ModuleSettings.GetModuleSettings(moduleId); config = new BlogConfiguration(moduleSettings); if (config.FeedIsDisabled) { canView = false; } if ((config.FeedburnerFeedUrl.Length > 0) && (config.FeedburnerFeedUrl.StartsWith("http")) && (BlogConfiguration.UseRedirectForFeedburner)) { shouldRedirectToFeedburner = true; if ((Request.UserAgent != null) && (Request.UserAgent.Contains("FeedBurner"))) { shouldRedirectToFeedburner = false; // don't redirect if the feedburner bot is reading the feed } Guid redirectBypassToken = WebUtils.ParseGuidFromQueryString("r", Guid.Empty); if (redirectBypassToken == Global.FeedRedirectBypassToken) { shouldRedirectToFeedburner = false; // allows time for user to subscribe to autodiscovery links without redirecting } } }
public override void RebuildIndex( PageSettings pageSettings, string indexPath) { if (WebConfigSettings.DisableSearchIndex) { return; } if (pageSettings == null) { return; } //don't index pending/unpublished pages if (pageSettings.IsPending) { return; } log.Info("CalendarEventIndexBuilderProvider indexing page - " + pageSettings.PageName); try { Guid calendarFeatureGuid = new Guid("c5e6a5df-ac2a-43d3-bb7f-9739bc47194e"); ModuleDefinition calendarFeature = new ModuleDefinition(calendarFeatureGuid); List <PageModule> pageModules = PageModule.GetPageModulesByPage(pageSettings.PageId); DataTable dataTable = CalendarEvent.GetEventsByPage(pageSettings.SiteId, pageSettings.PageId); foreach (DataRow row in dataTable.Rows) { mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem(); indexItem.SiteId = pageSettings.SiteId; indexItem.PageId = pageSettings.PageId; indexItem.PageName = pageSettings.PageName; indexItem.PageIndex = pageSettings.PageIndex; indexItem.ViewRoles = pageSettings.AuthorizedRoles; indexItem.ModuleViewRoles = row["ViewRoles"].ToString(); indexItem.FeatureId = calendarFeatureGuid.ToString(); indexItem.FeatureName = calendarFeature.FeatureName; indexItem.FeatureResourceFile = calendarFeature.ResourceFile; indexItem.ItemId = Convert.ToInt32(row["ItemID"], CultureInfo.InvariantCulture); indexItem.ModuleId = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture); indexItem.ModuleTitle = row["ModuleTitle"].ToString(); indexItem.Title = row["Title"].ToString(); indexItem.Content = row["Description"].ToString(); indexItem.ViewPage = "EventCalendar/EventDetails.aspx"; indexItem.CreatedUtc = Convert.ToDateTime(row["CreatedDate"]); indexItem.LastModUtc = Convert.ToDateTime(row["LastModUtc"]); // lookup publish dates foreach (PageModule pageModule in pageModules) { if (indexItem.ModuleId == pageModule.ModuleId) { indexItem.PublishBeginDate = pageModule.PublishBeginDate; indexItem.PublishEndDate = pageModule.PublishEndDate; } } mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath); if (debugLog) { log.Debug("Indexed " + indexItem.Title); } } } catch (System.Data.Common.DbException ex) { log.Error(ex); } }
private void buttonCreate_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(docName)) { try { Assembly assembly = typeof(IPageInstance).Module.Assembly; AssemblyRefCreator.AssemblyRefCreateator(assembly, docName); #region nodes cration foreach (DataRow row in ((DataView)listview.ItemsSource).Table.Rows) { DataRowComponents rowData = (DataRowComponents)row["DataSource"]; XmlNode insertedNode = rowData.Tag as XmlNode; Uri uri = new Uri(docName); XmlElement newNode = insertedNode.OwnerDocument.CreateElement("Compile", insertedNode.NamespaceURI); string insertedNodeName = insertedNode.Attributes.GetNamedItem("Include").Value; string parsedInsertedNodeName = insertedNodeName; parsedInsertedNodeName = System.IO.Path.GetFileName(insertedNodeName); newNode.SetAttribute("Include", insertedNodeName.Replace(".aspx.cs", ".aspx.jaz.cs")); XmlElement dependentUponNode = insertedNode.OwnerDocument.CreateElement("DependentUpon", insertedNode.NamespaceURI); dependentUponNode.InnerText = parsedInsertedNodeName.Replace(".aspx.cs", ".aspx"); newNode.AppendChild(dependentUponNode); if ((bool)row["Existing jaz files"]) { if (insertedNode.ParentNode.SelectNodes("*[@Include='" + insertedNodeName.Replace(OldFileExtension, NewFileExtension) + "']").Count == 0) { insertedNode.ParentNode.InsertAfter(newNode, insertedNode); insertedNode.OwnerDocument.Save(docName); string fileFullPath = docName.Replace(uri.Segments[uri.Segments.Length - 1].ToString(), "") + insertedNode.Attributes.GetNamedItem("Include").Value .Replace(OldFileExtension, NewFileExtension); ProgectSettings.AddNewJazFile(fileFullPath); FileInfo newFile = new FileInfo(fileFullPath); FileStream fs = newFile.Create(); fs.Dispose(); CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp"); string ns = row["Guessed namespace"].ToString(); string cn = row["Guessed class name"].ToString(); FileGenerator.GenerateCode ( provider, FileGenerator.BuildJAZContent(ns, cn, insertedNodeName), fileFullPath ); string exportFilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(docName), "ExportSetting.xml"); PageSettings pageSet = new PageSettings(exportFilePath, insertedNodeName, ns, cn); XmlStoreProvider storeProvider = new XmlStoreProvider(exportFilePath); ProgectSettings.SelectedPage = pageSet; storeProvider.SaveSettings(ProgectSettings); } } else { XmlNode removedNode = insertedNode.ParentNode.SelectSingleNode("*[@Include='" + insertedNodeName.Replace(OldFileExtension, NewFileExtension) + "']"); if (removedNode != null) { insertedNode.ParentNode.RemoveChild(removedNode); insertedNode.OwnerDocument.Save(docName); string unselectedFileName = docName.Replace(uri.Segments[uri.Segments.Length - 1].ToString(), "") + insertedNode.Attributes.GetNamedItem("Include").Value .Replace(OldFileExtension, NewFileExtension); FileInfo newFile = new FileInfo(unselectedFileName); newFile.Delete(); if (ProgectSettings.GetJazFileCollection().Contains(unselectedFileName)) { ProgectSettings.RemoveJazFileFromCollection(unselectedFileName); } } } } if (((DataView)listview.ItemsSource).Table.Rows.Count != 0) { MessageBox.Show("Modify proccess successed", "executed", MessageBoxButton.OK); listview.Focus(); } #endregion } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private static void IndexItem(HtmlContent content) { bool disableSearchIndex = ConfigHelper.GetBoolProperty("DisableSearchIndex", false); if (disableSearchIndex) { return; } Module module = new Module(content.ModuleId); Guid htmlFeatureGuid = new Guid("881e4e00-93e4-444c-b7b0-6672fb55de10"); ModuleDefinition htmlFeature = new ModuleDefinition(htmlFeatureGuid); // get list of pages where this module is published List <PageModule> pageModules = PageModule.GetPageModulesByModule(content.ModuleId); foreach (PageModule pageModule in pageModules) { PageSettings pageSettings = new PageSettings( content.SiteId, pageModule.PageId); //don't index pending/unpublished pages if (pageSettings.IsPending) { continue; } IndexItem indexItem = new IndexItem(); if (content.SearchIndexPath.Length > 0) { indexItem.IndexPath = content.SearchIndexPath; } indexItem.SiteId = content.SiteId; indexItem.ExcludeFromRecentContent = content.ExcludeFromRecentContent; indexItem.PageId = pageModule.PageId; indexItem.PageName = pageSettings.PageName; indexItem.ViewRoles = pageSettings.AuthorizedRoles; indexItem.ModuleViewRoles = module.ViewRoles; if (pageSettings.UseUrl) { indexItem.ViewPage = pageSettings.Url.Replace("~/", string.Empty); indexItem.UseQueryStringParams = false; } // generally we should not include the page meta because it can result in duplicate results // one for each instance of html content on the page because they all use the smae page meta. // since page meta should reflect the content of the page it is sufficient to just index the content if ((ConfigurationManager.AppSettings["IndexPageMeta"] != null) && (ConfigurationManager.AppSettings["IndexPageMeta"] == "true")) { indexItem.PageMetaDescription = pageSettings.PageMetaDescription; indexItem.PageMetaKeywords = pageSettings.PageMetaKeyWords; } indexItem.FeatureId = htmlFeatureGuid.ToString(); indexItem.FeatureName = htmlFeature.FeatureName; indexItem.FeatureResourceFile = htmlFeature.ResourceFile; indexItem.ItemId = content.ItemId; indexItem.ModuleId = content.ModuleId; indexItem.ModuleTitle = module.ModuleTitle; indexItem.Title = content.Title; indexItem.Content = SecurityHelper.RemoveMarkup(content.Body); indexItem.PublishBeginDate = pageModule.PublishBeginDate; indexItem.PublishEndDate = pageModule.PublishEndDate; if ((content.CreatedByFirstName.Length > 0) && (content.CreatedByLastName.Length > 0)) { indexItem.Author = string.Format(CultureInfo.InvariantCulture, Resource.FirstLastFormat, content.CreatedByFirstName, content.CreatedByLastName); } else { indexItem.Author = content.CreatedByName; } indexItem.CreatedUtc = content.CreatedDate; indexItem.LastModUtc = content.LastModUtc; if (!module.IncludeInSearch) { indexItem.RemoveOnly = true; } IndexHelper.RebuildIndex(indexItem); } log.Debug("Indexed " + content.Title); }
private void LoadSettings(HttpContext context) { siteSettings = CacheHelper.GetCurrentSiteSettings(); if (siteSettings == null) { return; } pageId = WebUtils.ParseInt32FromQueryString("pageid", true, pageId); moduleId = WebUtils.ParseInt32FromQueryString("mid", true, moduleId); if (moduleId == -1) { return; } if (pageId == -1) { return; } galleryPage = new PageSettings(siteSettings.SiteId, pageId); if (galleryPage.PageId == -1) { return; } galleryModule = new Module(moduleId, pageId); if (galleryModule.ModuleId == -1) { return; } if ((!WebUser.IsInRoles(galleryPage.AuthorizedRoles)) && (!WebUser.IsInRoles(galleryModule.ViewRoles))) { return; } siteRoot = WebUtils.GetSiteRoot(); //thumbnailBaseUrl = siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() // + "/GalleryImages/" + moduleId.ToInvariantString() + "/Thumbnails/"; //fullSizeBaseUrl = siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() // + "/GalleryImages/" + moduleId.ToInvariantString() + "/WebImages/"; string baseUrl; if (WebConfigSettings.ImageGalleryUseMediaFolder) { baseUrl = siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/media/GalleryImages/" + moduleId.ToInvariantString() + "/"; } else { baseUrl = siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/GalleryImages/" + moduleId.ToInvariantString() + "/"; } thumbnailBaseUrl = baseUrl + "Thumbnails/"; fullSizeBaseUrl = baseUrl + "WebImages/"; gallery = new Gallery(moduleId); canRender = true; }
/// <summary> /// Converts the given <paramref name="inputUri" /> to PDF /// </summary> /// <param name="inputUri">The webpage to convert</param> /// <param name="outputStream">The output stream</param> /// <param name="pageSettings"><see cref="PageSettings"/></param> /// <param name="waitForWindowStatus">Wait until the javascript window.status has this value before /// rendering the PDF</param> /// <param name="waitForWindowsStatusTimeout"></param> /// <param name="conversionTimeout">An conversion timeout in milliseconds, if the conversion failes /// to finished in the set amount of time then an <see cref="ConversionTimedOutException"/> is raised</param> /// <exception cref="ConversionTimedOutException">Raised when <see cref="conversionTimeout"/> is set and the /// conversion fails to finish in this amount of time</exception> public void ConvertToPdf(ConvertUri inputUri, Stream outputStream, PageSettings pageSettings, string waitForWindowStatus = "", int waitForWindowsStatusTimeout = 60000, int?conversionTimeout = null) { if (inputUri.IsFile && !File.Exists(inputUri.OriginalString)) { throw new FileNotFoundException($"The file '{inputUri.OriginalString}' does not exists"); } FileInfo preWrappedFile = null; try { if (inputUri.IsFile && CheckForPreWrap(inputUri, out var preWrapFile)) { inputUri = new ConvertUri(preWrapFile); preWrappedFile = new FileInfo(preWrapFile); } else if (ImageResize || ImageRotate) { if (!ImageHelper.ValidateImages(inputUri, ImageResize, ImageRotate, pageSettings, out var outputUri)) { inputUri = outputUri; } } StartChromeHeadless(); CountdownTimer countdownTimer = null; if (conversionTimeout.HasValue) { if (conversionTimeout <= 1) { throw new ArgumentOutOfRangeException($"The value for {nameof(countdownTimer)} has to be a value equal to 1 or greater"); } WriteToLog($"Conversion timeout set to {conversionTimeout.Value} milliseconds"); countdownTimer = new CountdownTimer(conversionTimeout.Value); countdownTimer.Start(); } WriteToLog("Loading " + (inputUri.IsFile ? "file " + inputUri.OriginalString : "url " + inputUri)); _communicator.NavigateTo(inputUri, countdownTimer); if (!string.IsNullOrWhiteSpace(waitForWindowStatus)) { if (conversionTimeout.HasValue) { WriteToLog("Conversion timeout paused because we are waiting for a window.status"); countdownTimer.Stop(); } WriteToLog($"Waiting for window.status '{waitForWindowStatus}' or a timeout of {waitForWindowsStatusTimeout} milliseconds"); var match = _communicator.WaitForWindowStatus(waitForWindowStatus, waitForWindowsStatusTimeout); WriteToLog(!match ? "Waiting timed out" : $"Window status equaled {waitForWindowStatus}"); if (conversionTimeout.HasValue) { WriteToLog("Conversion timeout started again because we are done waiting for a window.status"); countdownTimer.Start(); } } WriteToLog((inputUri.IsFile ? "File" : "Url") + " loaded"); WriteToLog("Converting to PDF"); using (var memorystream = new MemoryStream(_communicator.PrintToPdf(pageSettings, countdownTimer).Bytes)) { memorystream.Position = 0; memorystream.CopyTo(outputStream); } WriteToLog("Converted"); } finally { if (preWrappedFile != null) { WriteToLog("Deleting prewrapped file"); preWrappedFile.Delete(); } } }
void printSN(PrintPageEventArgs e) { partRows = Properties.Settings.Default.partRows; pageNbr = Properties.Settings.Default.pageNbr; e.HasMorePages = false; PageSettings page = GetPrinterPageInfo(); RectangleF area = page.PrintableArea; Rectangle bounds = page.Bounds; Margins margins = page.Margins; //Podesavanje pocetka ispisa za ostale listove od vrha (default = 100) //margins.Bottom = margins.Bottom / 2; margins.Top = margins.Top / 2; headerpointVer = margins.Top; headerpointHor = bounds.Right - margins.Right; int napomenaHeight = bounds.Bottom - margins.Bottom - moveBy * 5; try { String workingStr = ""; float measureStr = 0; float measureField = 0; using (img) { partRows = Properties.Settings.Default.partRows; var groupedPartsListSN = partListPrint.GroupBy(c => c.PartialCode).Select(grp => grp.ToList()).ToList(); if (partRows >= groupedPartsListSN.Count) { Properties.Settings.Default.printingSN = true; Properties.Settings.Default.partRows = partRows = 0; } //if (partRows >= 35) //Ovo je test if (partRows <= groupedPartsListSN.Count) //Ovo je test { //headerpointVer = bounds.Bottom + margins.Top; //TODO OVO SAM ZAKOMENTIRAO JER MI JE PRINTAO BESKONACNO STRANICA - TREBA TESTIRATI imgW = imgW / 2; //80 imgH = (int)((double)imgW / imgScale); //75 //40 if (!signatureInitiated) { e.Graphics.DrawImage(img, bounds.Right - imgW - margins.Right, bounds.Top + margins.Top, imgW, imgH); headerpointVer = bounds.Top + margins.Top + imgH + 50; e.Graphics.DrawRectangle(new Pen(Brushes.Black), margins.Left, headerpointVer, bounds.Right - margins.Right - margins.Left, 20); e.Graphics.FillRectangle(exeBrush, margins.Left + 1, headerpointVer + 1, bounds.Right - margins.Right - margins.Left - 2, 18); } int total = bounds.Right - margins.Left - margins.Right; int rbSN = margins.Left + total / 17; int field = (total - (rbSN - margins.Left)) / 3; int codeSN = rbSN + field; int snSN = rbSN + field * 2; int rowHeight = 20; Font fnt = fitFontSizeBold(e, workingStr, fontSizeS, rbSN - margins.Left); if (!signatureInitiated) { workingStr = Properties.strings.PARTLIST; measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; e.Graphics.DrawString(workingStr, new Font("Calibri light", fontSizeS + 2, FontStyle.Bold), Brushes.Black, new Point((bounds.Right / 2) - ((int)measureStr / 2), headerpointVer - 25)); //GRID e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(rbSN, headerpointVer), new Point(rbSN, headerpointVer + rowHeight)); e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(codeSN, headerpointVer), new Point(codeSN, headerpointVer + rowHeight)); e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(snSN, headerpointVer), new Point(snSN, headerpointVer + rowHeight)); Brush tmpBrush = Brushes.White; workingStr = "RB"; fnt = fitFontSizeBold(e, workingStr, fontSizeR, rbSN - margins.Left); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = rbSN - margins.Left; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, rbSN - margins.Left), tmpBrush, new Point(margins.Left + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); workingStr = Properties.strings.CODE; fnt = fitFontSizeBold(e, workingStr, fontSizeR, codeSN - rbSN); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = codeSN - rbSN; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, codeSN - rbSN), tmpBrush, new Point(rbSN + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); workingStr = Properties.strings.SERIALNBR + "."; fnt = fitFontSizeBold(e, workingStr, fontSizeR, snSN - codeSN); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = snSN - codeSN; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, snSN - codeSN), tmpBrush, new Point(codeSN + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); workingStr = Properties.strings.CUSTOMERNBR + "."; fnt = fitFontSizeBold(e, workingStr, fontSizeR, bounds.Right - margins.Right - snSN); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = bounds.Right - margins.Right - snSN; e.Graphics.DrawString(workingStr, getFont(8), tmpBrush, new Point(snSN + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); } //Doc INFO e.Graphics.DrawString(Properties.strings.Page + " : " + pageNbr, getFont(8), Brushes.Black, new Point(margins.Left, bounds.Bottom - margins.Bottom)); Properties.Settings.Default.pageNbr = pageNbr = pageNbr + 1; Properties.Settings.Default.Save(); fnt = fitFontSize(e, (partRows + 1).ToString(), fontSizeR, codeSN - rbSN); workingStr = Properties.strings.Document + ": " + PrimkaNumber; measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = bounds.Right - margins.Right - margins.Left; e.Graphics.DrawString(workingStr, fnt, Brushes.Black, new Point(margins.Left + (((int)measureField - (int)measureStr) / 2), bounds.Bottom - margins.Bottom)); workingStr = Properties.Settings.Default.CmpWWW; fnt = fitFontSize(e, workingStr, fontSizeR, codeSN - rbSN); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; e.Graphics.DrawString(workingStr, getFont(8), Brushes.Black, new Point(bounds.Right - margins.Right - (int)measureStr, bounds.Bottom - margins.Bottom)); if (!signatureInitiated) { //var groupedPartsList = partListPrint.GroupBy(c => c.PartialCode).Select(grp => grp.ToList()).ToList(); //for (; partRows < 35; partRows++) for (; partRows < groupedPartsListSN.Count; partRows++) { //int rbInner = 1;int partRowsInner = 0 for (; partRowsInner < groupedPartsListSN[partRows].Count; partRowsInner++) { if (headerpointVer + (moveBy * 4) + 20 > (bounds.Bottom - margins.Bottom)) { //printingSN = true; e.HasMorePages = true; Properties.Settings.Default.printingSN = true; Properties.Settings.Default.pageNbr = pageNbr; Properties.Settings.Default.partRows = partRows; return; } headerpointVer = headerpointVer + (moveBy * 3); //e.Graphics.DrawRectangle(new Pen(Brushes.Black), margins.Left, headerpointVer, bounds.Right - margins.Right - margins.Left, 20); //e.Graphics.DrawLine(new Pen(Brushes.Black), margins.Left, headerpointVer + (moveBy * 2), bounds.Right - margins.Right, headerpointVer + (moveBy * 2)); float[] dashValues = { 2, 2, 2, 2 }; Pen blackPen = new Pen(Color.Black, 1); blackPen.DashPattern = dashValues; e.Graphics.DrawLine(blackPen, margins.Left, headerpointVer + (moveBy * 3), bounds.Right - margins.Right, headerpointVer + (moveBy * 3)); workingStr = (partRows + 1).ToString() + " - " + rbInner;//tu partRows fnt = fitFontSize(e, workingStr, fontSizeR, rbSN - margins.Left); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = rbSN - margins.Left; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, rbSN - margins.Left), Brushes.Black, new Point(margins.Left + (((int)measureField - (int)measureStr) / 2), headerpointVer + moveBy * 2)); // + moveBy workingStr = string.Format("{0:000}", groupedPartsListSN[partRows][partRowsInner].CompanyO) + string.Format("{0:00}", groupedPartsListSN[partRows][partRowsInner].CompanyC) + string.Format("{0:000000000}", groupedPartsListSN[partRows][partRowsInner].PartialCode); //tu partRows fnt = fitFontSizeIDAutomation(e, workingStr, fontSizeR, codeSN - rbSN); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = codeSN - rbSN; e.Graphics.DrawString("*" + workingStr + "*", fitFontSizeIDAutomation(e, workingStr, 6, codeSN - rbSN), Brushes.Black, new Point(rbSN + (((int)measureField - (int)measureStr) / 2), headerpointVer)); // + moveBy workingStr = groupedPartsListSN[partRows][partRowsInner].SN.ToString(); //tu fnt = fitFontSizeIDAutomation(e, workingStr, fontSizeR, snSN - codeSN); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = snSN - codeSN; e.Graphics.DrawString("*" + workingStr + "*", fitFontSizeIDAutomation(e, workingStr, 6, snSN - codeSN), Brushes.Black, new Point(codeSN + (((int)measureField - (int)measureStr) / 2), headerpointVer)); // + moveBy workingStr = groupedPartsListSN[partRows][partRowsInner].CN.ToString(); //tu fnt = fitFontSizeIDAutomation(e, (partRows + 1).ToString(), fontSizeR, bounds.Right - margins.Right - snSN); //tu measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = bounds.Right - margins.Right - snSN; e.Graphics.DrawString("*" + workingStr + "*", fitFontSizeIDAutomation(e, workingStr, 6, bounds.Right - margins.Right - snSN), Brushes.Black, new Point(snSN + (((int)measureField - (int)measureStr) / 2), headerpointVer)); // + moveBy rbInner++; } partRowsInner = 0; rbInner = 1; } } if (signature) { signatureInitiated = true; headerpointVer = headerpointVer + (moveBy * 12); //if (headerpointVer + (moveBy * 16) + 20 > (bounds.Bottom - margins.Bottom)) if (headerpointVer + 40 > (bounds.Bottom - margins.Bottom)) { //printingSN = true; e.HasMorePages = true; Properties.Settings.Default.printingSN = true; Properties.Settings.Default.pageNbr = pageNbr; Properties.Settings.Default.partRows = partRows; return; } int lineLength = (bounds.Right - margins.Right - margins.Left) / 4; e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(margins.Left, headerpointVer), new Point(margins.Left + lineLength, headerpointVer)); headerpointVer = headerpointVer + (moveBy / 2); workingStr = Properties.strings.DateSignature; fnt = fitFontSize(e, workingStr, 7, lineLength); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; e.Graphics.DrawString(workingStr, fnt, Brushes.Black, new Point(margins.Left + ((lineLength - (int)measureStr) / 2), headerpointVer)); headerpointVer = headerpointVer + (moveBy * 4); e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(margins.Left, headerpointVer), new Point(margins.Left + lineLength, headerpointVer)); headerpointVer = headerpointVer + (moveBy / 2); workingStr = Properties.strings.Signature; measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; e.Graphics.DrawString(workingStr, fnt, Brushes.Black, new Point(margins.Left + ((lineLength - (int)measureStr) / 2), headerpointVer)); } Properties.Settings.Default.printingSN = false; e.HasMorePages = false; partRowsInner = 0; rbInner = 1; signatureInitiated = false; return; } } } catch (Exception e1) { new LogWriter(e1); MessageBox.Show(e1.Message); } }
/// <summary> /// コンストラクターを定義し、引数に構成情報を取得するクラスを定義する。 /// </summary> /// <param name="userSettings"></param> /// <param name="pageSettings"></param> public HomeController(IOptions <UserSettings> userSettings, IOptions <PageSettings> pageSettings) { //ユーザー設定情報インスタンスをフィールドに保持 this._userSettings = userSettings.Value; this._pageSettings = pageSettings.Value; }
void printParts(PrintPageEventArgs e) { partRows = Properties.Settings.Default.partRows; pageNbr = Properties.Settings.Default.pageNbr; //datumIzrade = DateTime.Now.ToString("10.02.20."); //datumIspisa = DateTime.Now.ToString("10.02.20."); if (datumIzrade.Equals("")) { datumIzrade = DateTime.Now.ToString("dd.MM.yy."); } if (datumIspisa.Equals("")) { datumIspisa = DateTime.Now.ToString("dd.MM.yy."); } if (izradioUser.Equals("")) { izradioUser = WorkingUser.UserID.ToString(); } if (izradioRegija.Equals("")) { izradioRegija = WorkingUser.RegionID.ToString(); } e.HasMorePages = false; PageSettings page = GetPrinterPageInfo(); RectangleF area = page.PrintableArea; Rectangle bounds = page.Bounds; Margins margins = page.Margins; //Podesavanje pocetka ispisa za prvi list od vrha (default = 100) //margins.Bottom = margins.Bottom / 2; //adobe me jbe kod snimanja ako je tako mala margina margins.Top = margins.Top / 2; headerpointVer = margins.Top; headerpointHor = bounds.Right - margins.Right; int napomenaHeight = bounds.Bottom - margins.Bottom - moveBy * 5; try { String workingStr = ""; float measureStr = 0; float measureField = 0; using (img) { //var groupedPartsList = partListPrint.GroupBy(c => c.PartialCode).Select(grp => grp.ToList()).ToList(); if (pageNbr == 1) { //Sender/Receiver Company Info e.Graphics.DrawString(recipientSender + ": ", new Font("Calibri light", fontSizeS - 1, FontStyle.Underline | FontStyle.Italic), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy / 2))); e.Graphics.DrawString(cmpS.Name, new Font("Calibri light", fontSizeS, FontStyle.Bold), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * 2))); e.Graphics.DrawString(cmpS.Address, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * 3))); e.Graphics.DrawString(cmpS.Country + " - " + cmpS.City + ", " + cmpS.PB, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * 4))); e.Graphics.DrawString(Properties.strings.VAT + ": " + cmpS.OIB, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * 5))); e.Graphics.DrawString(Environment.NewLine, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * 6 / 2))); int pomak = 8; if (!branch.FilNumber.Equals("")) { //String podaciOFilijali = + Environment.NewLine + "Address: " + branch.Address + ", " + branch.Pb + " " + branch.City + ", " + branch.Country; e.Graphics.DrawString(Properties.strings.branchNbr + ": " + branch.FilNumber, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * pomak))); e.Graphics.DrawString(Properties.strings.branchAddress + ": " + branch.Address + ", " + branch.Pb + " " + branch.City + ", " + branch.Country, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * (pomak + 1)))); pomak = pomak + 2; } //PRVI RED JE NASLOV ZA IZRADIO e.Graphics.DrawString(Properties.strings.MadeBy.ToUpper() + ": ", new Font("Calibri light", fontSizeS - 1, FontStyle.Underline | FontStyle.Italic), Brushes.Black, new Point(margins.Left, margins.Top - 5 + (moveBy * (pomak + 3)))); e.Graphics.DrawString(Properties.strings.Date + ": " + datumIzrade, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * (pomak + 4)))); e.Graphics.DrawString(Properties.strings.Time + ": " + datumIspisa, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * (pomak + 5)))); e.Graphics.DrawString(Properties.strings.UserID + ": " + izradioUser, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * (pomak + 6)))); e.Graphics.DrawString(Properties.strings.RegionID + ": " + izradioRegija, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * (pomak + 7)))); //KORISNIK - da se ne vidi ime i prezime, odkomentiraj da se vidi //e.Graphics.DrawString(Properties.strings.MadeBy + ": " + WorkingUser.Name + " " + WorkingUser.Surename, new Font("Calibri light", fontSizeS, FontStyle.Regular), Brushes.Black, new Point(margins.Left, margins.Top + (moveBy * 13))); //MyCompany Info e.Graphics.DrawImage(img, bounds.Right - imgW - margins.Right, bounds.Top + margins.Top, imgW, imgH); String MainCmpPrintAddress = Properties.Settings.Default.CmpAddress + ", " + Properties.Settings.Default.CmpCountry + " - " + Properties.Settings.Default.CmpPB + " " + Properties.Settings.Default.CmpCity; e.Graphics.DrawString(Properties.Settings.Default.CmpName, new Font("Calibri light", fontSizeR, FontStyle.Bold), Brushes.Black, new Point(bounds.Right - margins.Right - (imgW - imgW / 7), margins.Top + imgH + (moveBy))); e.Graphics.DrawString(MainCmpPrintAddress, new Font("Calibri light", fontSizeR, FontStyle.Regular), Brushes.Black, new Point(bounds.Right - margins.Right - (imgW - imgW / 7), margins.Top + imgH + (moveBy * 2))); e.Graphics.DrawString("MB: " + Properties.Settings.Default.CmpMB, new Font("Calibri light", fontSizeR, FontStyle.Regular), Brushes.Black, new Point(bounds.Right - margins.Right - (imgW - imgW / 7), margins.Top + imgH + (moveBy * 3))); e.Graphics.DrawString(Properties.strings.VAT + ": " + Properties.Settings.Default.CmpVAT, new Font("Calibri light", fontSizeR, FontStyle.Regular), Brushes.Black, new Point(bounds.Right - margins.Right - (imgW - imgW / 7), margins.Top + imgH + (moveBy * 4))); e.Graphics.DrawString("Tel: " + Properties.Settings.Default.CmpPhone, new Font("Calibri light", fontSizeR, FontStyle.Regular), Brushes.Black, new Point(bounds.Right - margins.Right - (imgW - imgW / 7), margins.Top + imgH + (moveBy * 5))); e.Graphics.DrawString("IBAN: " + Properties.Settings.Default.CmpIBAN, new Font("Calibri light", fontSizeR, FontStyle.Regular), Brushes.Black, new Point(bounds.Right - margins.Right - (imgW - imgW / 7), margins.Top + imgH + (moveBy * 6))); e.Graphics.DrawString(Properties.strings.SWIFT + ": " + Properties.Settings.Default.CmpSWIFT, new Font("Calibri light", fontSizeR, FontStyle.Regular), Brushes.Black, new Point(bounds.Right - margins.Right - (imgW - imgW / 7), margins.Top + imgH + (moveBy * 7))); headerpointVer = margins.Top + imgH + (moveBy * 7) + 100; headerpointHor = bounds.Right - margins.Right - imgW; workingStr = documentName; measureStr = e.Graphics.MeasureString(workingStr, new Font("Calibri light", fontSizeS + 4, FontStyle.Bold)).Width; e.Graphics.DrawString(workingStr, new Font("Calibri light", fontSizeS + 2, FontStyle.Bold), Brushes.Black, new Point((bounds.Right / 2) - ((int)measureStr / 2), headerpointVer)); e.Graphics.DrawString(Properties.strings.DocumentNbr + " " + PrimkaNumber, new Font("Calibri light", fontSizeS, FontStyle.Bold), Brushes.Black, new Point(margins.Left, headerpointVer + (moveBy * 2))); headerpointVer = headerpointVer + (moveBy * 4); } else { imgW = imgW / 2; //80 imgH = (int)((double)imgW / imgScale); //75 //40 e.Graphics.DrawImage(img, bounds.Right - imgW - margins.Right, bounds.Top + margins.Top, imgW, imgH); headerpointVer = bounds.Top + margins.Top + imgH + 50; } e.Graphics.DrawRectangle(new Pen(Brushes.Black), margins.Left, headerpointVer, bounds.Right - margins.Right - margins.Left, 20); e.Graphics.FillRectangle(exeBrush, margins.Left + 1, headerpointVer + 1, bounds.Right - margins.Right - margins.Left - 2, 18); int total = bounds.Right - margins.Left - margins.Right; int rb = margins.Left + total / 17; int code = rb + total / 5; int name = code + total / 2; int mes = name + total / 9; int rowHeight = 20; //GRID e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(rb, headerpointVer), new Point(rb, headerpointVer + rowHeight)); e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(code, headerpointVer), new Point(code, headerpointVer + rowHeight)); e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(name, headerpointVer), new Point(name, headerpointVer + rowHeight)); e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(mes, headerpointVer), new Point(mes, headerpointVer + rowHeight)); Font fnt = getFont(fontSizeR); Brush tmpBrush = Brushes.White; workingStr = "RB"; fnt = fitFontSizeBold(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = rb - margins.Left; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, code - rb), tmpBrush, new Point(margins.Left + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); workingStr = Properties.strings.CODE; fnt = fitFontSizeBold(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = code - rb; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, code - rb), tmpBrush, new Point(rb + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); workingStr = Properties.strings.NAME; fnt = fitFontSizeBold(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = name - code; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, code - rb), tmpBrush, new Point(code + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); workingStr = Properties.strings.PACK + "."; fnt = fitFontSizeBold(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = mes - name; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, code - rb), tmpBrush, new Point(name + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); workingStr = Properties.strings.QUA + "."; fnt = fitFontSizeBold(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = bounds.Right - margins.Right - mes; e.Graphics.DrawString(workingStr, getFont(8), tmpBrush, new Point(mes + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); var groupedPartsList = partListPrint.GroupBy(c => c.PartialCode).Select(grp => grp.ToList()).ToList(); //for (; partRows < 35; partRows++) for (; partRows < groupedPartsList.Count; partRows++) { if (headerpointVer + (moveBy * 4) + 20 > napomenaHeight && napomenaHeight != 0) { e.HasMorePages = true; Properties.Settings.Default.printingSN = false; break; } else { Properties.Settings.Default.printingSN = true; } headerpointVer = headerpointVer + (moveBy * 2); //e.Graphics.DrawRectangle(new Pen(Brushes.Black), margins.Left, headerpointVer, bounds.Right - margins.Right - margins.Left, 20); //e.Graphics.DrawLine(new Pen(Brushes.Black), margins.Left, headerpointVer + (moveBy * 2), bounds.Right - margins.Right, headerpointVer + (moveBy * 2)); //NAZIV workingStr = sifrarnikArr[(sifrarnikArr.IndexOf((groupedPartsList[partRows][0].PartialCode).ToString())) - 1];//tu fnt = fitFontSize(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = name - code; //e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, code - rb), Brushes.Black, new Point(code + 3, headerpointVer + moveBy)); List <String> naziv = wordWrraper(e, measureField, workingStr, fontSizeR); int pamtiHeadPointVer = headerpointVer; foreach (String n in naziv) { fnt = fitFontSize(e, n, fontSizeR, measureField); //e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, code - rb), tmpBrush, new Point(code + (((int)measureField - (int)measureStr) / 2), headerpointVer + rowHeight / 4)); e.Graphics.DrawString(n, fnt, Brushes.Black, new Point(code + 3, headerpointVer + moveBy)); headerpointVer += moveBy; } pamtiHeadPointVer = headerpointVer; //SIFRA workingStr = string.Format("{0:000}", groupedPartsList[partRows][0].CompanyO) + string.Format("{0:00}", groupedPartsList[partRows][0].CompanyC) + " " + string.Format("{0:000 000 000}", groupedPartsList[partRows][0].PartialCode);//tu partRows fnt = fitFontSize(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = code - rb; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, code - rb), Brushes.Black, new Point(rb + (((int)measureField - (int)measureStr) / 2), headerpointVer));// + moveBy)); //LINIJA float[] dashValues = { 2, 2, 2, 2 }; Pen blackPen = new Pen(Color.Black, 1); blackPen.DashPattern = dashValues; e.Graphics.DrawLine(blackPen, margins.Left, headerpointVer + (moveBy * 1), bounds.Right - margins.Right, pamtiHeadPointVer + (moveBy * 1)); //KOM QueryCommands qc = new QueryCommands(); workingStr = qc.PartInfoByFullCodeSifrarnik(groupedPartsList[partRows][0].PartialCode).Packing; fnt = fitFontSize(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = mes - name; e.Graphics.DrawString(workingStr, fitFontSize(e, workingStr, fontSizeR, code - rb), Brushes.Black, new Point(name + (((int)measureField - (int)measureStr) / 2), pamtiHeadPointVer));// + moveBy)); //KOLICINA workingStr = groupedPartsList[partRows].Count.ToString();//tu fnt = fitFontSize(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = bounds.Right - margins.Right - mes; e.Graphics.DrawString(workingStr, getFont(8), Brushes.Black, new Point(mes + (((int)measureField - (int)measureStr) / 2), pamtiHeadPointVer));// + moveBy)); //RB fnt = fitFontSize(e, (partRows + 1).ToString(), fontSizeR, code - rb); //tu workingStr = (partRows + 1).ToString(); //tu measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = rb - margins.Left; e.Graphics.DrawString(workingStr, fnt, Brushes.Black, new Point(margins.Left + (((int)measureField - (int)measureStr) / 2), pamtiHeadPointVer));// + moveBy)); } Properties.Settings.Default.partRows = partRows; if (groupedPartsList.Count == 0) { e.HasMorePages = false; } else { e.HasMorePages = true; } //NAPOMENA if (pageNbr == 1) { napomenaHeight = 0; workingStr = Properties.strings.NOTE + ": " + napomenaPRIMPrint; measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = bounds.Right - margins.Right - margins.Left; int ii = 5; int secondLine = 0; int wsNAPOMENAw = (int)e.Graphics.MeasureString(Properties.strings.NOTE + ":", fnt).Width; String ws1 = ""; while (measureStr > measureField) { ws1 = workingStr; int ws1Lenght = (int)e.Graphics.MeasureString(ws1, fnt).Width; while (ws1Lenght > measureField) { ws1 = ws1.Substring(0, ws1.Length - 1); ws1Lenght = (int)e.Graphics.MeasureString(ws1, fnt).Width; } e.Graphics.DrawString(ws1, fnt, Brushes.Black, new Point(margins.Left + secondLine, bounds.Bottom - margins.Bottom - moveBy * ii--)); secondLine = wsNAPOMENAw; workingStr = workingStr.Substring(ws1.Length); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = bounds.Right - margins.Right - margins.Left - wsNAPOMENAw; } e.Graphics.DrawString(workingStr, fnt, Brushes.Black, new Point(margins.Left + secondLine, bounds.Bottom - margins.Bottom - moveBy * ii--)); } e.Graphics.DrawString(Properties.strings.Page + " : " + pageNbr, getFont(8), Brushes.Black, new Point(margins.Left, bounds.Bottom - margins.Bottom)); Properties.Settings.Default.pageNbr = pageNbr = pageNbr + 1; fnt = fitFontSize(e, (partRows + 1).ToString(), fontSizeR, code - rb); workingStr = Properties.strings.Document + ": " + PrimkaNumber; measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; measureField = bounds.Right - margins.Right - margins.Left; e.Graphics.DrawString(workingStr, fnt, Brushes.Black, new Point(margins.Left + (((int)measureField - (int)measureStr) / 2), bounds.Bottom - margins.Bottom)); workingStr = Properties.Settings.Default.CmpWWW; fnt = fitFontSize(e, workingStr, fontSizeR, code - rb); measureStr = e.Graphics.MeasureString(workingStr, fnt).Width; e.Graphics.DrawString(workingStr, getFont(8), Brushes.Black, new Point(bounds.Right - margins.Right - (int)measureStr, bounds.Bottom - margins.Bottom)); } return; } catch (Exception e1) { new LogWriter(e1); MessageBox.Show(e1.Message); } }
private SiteMapNode CreateSiteMapNode( PageSettings page, int depth) { //string[] rolelist = null; List <string> roleList = null; if (!String.IsNullOrEmpty(page.AuthorizedRoles)) { //rolelist = page.AuthorizedRoles.Split(new char[] { ',', ';' }, 512); roleList = page.AuthorizedRoles.SplitOnChar(';'); } string pageUrl; if ( (page.UseUrl) && (!page.Url.StartsWith("http")) && (page.Url.Length > 0) && (useUrlRewriter) ) { pageUrl = page.Url; } else { pageUrl = "~/Default.aspx?pageid=" + page.PageId.ToString(); } // this was making a title (tooltip) on the link with the same text as the link text // not a good idea, adds no value and actually can make the page obnoxious for a screen reader user as it // would read the link text and the title //mojoSiteMapNode node = new mojoSiteMapNode( // this, // page.PageId.ToString(), // pageUrl, // HttpContext.Current.Server.HtmlEncode(page.PageName), // HttpContext.Current.Server.HtmlEncode(page.PageName), // rolelist, // null, // null, // null); mojoSiteMapNode node = new mojoSiteMapNode( this, page.PageId.ToString(), pageUrl, HttpContext.Current.Server.HtmlEncode(page.PageName), string.Empty, roleList, null, null, null); if ((page.MenuImage.Length > 0) && (page.MenuImage.ToLower().IndexOf("blank") == -1)) { node.MenuImage = this.iconBaseUrl + page.MenuImage; } node.PageGuid = page.PageGuid; node.PageId = page.PageId; node.ParentId = page.ParentId; node.Depth = depth; node.ViewRoles = page.AuthorizedRoles; node.EditRoles = page.EditRoles; node.DraftEditRoles = page.DraftEditOnlyRoles; node.CreateChildPageRoles = page.CreateChildPageRoles; node.CreateChildDraftPageRoles = page.CreateChildDraftRoles; node.IncludeInMenu = page.IncludeInMenu; node.IncludeInSiteMap = page.IncludeInSiteMap; node.ExpandOnSiteMap = page.ExpandOnSiteMap; node.IncludeInChildSiteMap = page.IncludeInChildSiteMap; node.IncludeInSearchMap = page.IncludeInSearchMap; node.LastModifiedUtc = page.LastModifiedUtc; node.ChangeFrequency = page.ChangeFrequency; node.SiteMapPriority = page.SiteMapPriority; node.OpenInNewWindow = page.OpenInNewWindow; node.HideAfterLogin = page.HideAfterLogin; node.UseSsl = (page.RequireSsl && sslIsAvailable); node.IsPending = page.IsPending; node.IsClickable = page.IsClickable; node.MenuCssClass = page.MenuCssClass; node.PublishMode = page.PublishMode; node.MenuDescription = page.MenuDescription; node.LinkRel = page.LinkRel; node.PubDateUtc = page.PubDateUtc; if (!this.nodes.ContainsKey(page.PageId)) { nodes.Add(page.PageId, node); } //this.CreateChildNodes(node, page, pageIndex); this.CreateChildNodes(node, page, depth + 1); return(node); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = "c:\\"; ofd.Filter = "project files (*.csproj)|*.csproj|All files (*.*)|*.*"; ofd.FilterIndex = 1; ofd.RestoreDirectory = true; if (ofd.ShowDialog() == true) { try { #region CheckBox list creator ProgectSettings = new ProjectSettings(); XmlDocument doc = new XmlDocument(); docName = ofd.FileName.ToString(); doc.Load(docName); XmlDocument docExport = new XmlDocument(); string exportFilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(docName), "ExportSetting.xml"); ProgectSettings.ExportFileName = exportFilePath; XmlNode root = doc.DocumentElement; XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("ns", root.NamespaceURI); Assembly assembly = typeof(IPageInstance).Module.Assembly; ProgectSettings.IsRefJCMSAdded = AssemblyRefCreator.IsAssemblyRefAdded(assembly, docName); ProgectSettings.AddBasePageToCollection("test"); ProgectSettings.AddBasePageToCollection("test2"); XmlNode nameSpace = root.SelectSingleNode("//ns:RootNamespace", nsmgr); jazNamespace = nameSpace.InnerText; ProgectSettings.RootNameSpace = jazNamespace; XmlNodeList nodeList = root.SelectNodes("//ns:Compile", nsmgr); List <XmlNode> nodeCollection = new List <XmlNode>(); foreach (XmlNode node in nodeList) { if (node.Attributes.GetNamedItem("Include").Value.Contains(OldFileExtension)) { nodeCollection.Add(node); } } List <DataRowComponents> dataRowCollection = new List <DataRowComponents>(); foreach (XmlNode selectedNodes in nodeCollection) { DataRowComponents dataRow = new DataRowComponents(); dataRow.IsSelected = false; string location = selectedNodes.Attributes.GetNamedItem("Include").Value; dataRow.Text = location; string xPath = "//ns:Compile[@Include='" + location.Replace(OldFileExtension, NewFileExtension) + "']"; XmlNodeList jazNodesList = root.SelectNodes(xPath, nsmgr); jazClassName = System.IO.Path.GetFileName(location).Replace(OldFileExtension, ""); string directory = System.IO.Path.GetDirectoryName(location).Replace("\\", "."); string jazNamespaceNode = jazNamespace; if (!string.IsNullOrEmpty(directory)) { jazNamespaceNode = jazNamespace + "." + directory; } dataRow.Namespace = jazNamespaceNode; dataRow.ClassName = jazClassName; string exFilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(docName), "ExportSetting.xml"); PageSettings pageSet = new PageSettings(exFilePath, location); XmlStoreProvider storeProvider = new XmlStoreProvider(exFilePath); ProgectSettings.SelectedPage = pageSet; storeProvider.LoadSettings(ProgectSettings); if (ProgectSettings.IsSetted) { dataRow.Namespace = ProgectSettings.SelectedPage.NameSpace; dataRow.ClassName = ProgectSettings.SelectedPage.ClassName; } if (jazNodesList.Count > 0) { dataRow.IsSelected = true; } dataRow.Tag = selectedNodes; dataRow.BasePage = "test2"; dataRowCollection.Add(dataRow); } DataSet dataSet = new DataSet("JazCmsDataSet"); DataTable dataTable = new DataTable("DataRowComponentsCollection"); DataTable basePageListTable = new DataTable("BasePageListTable"); basePageListTable.Columns.Add("BasePage", typeof(string)); foreach (string page in ProgectSettings.BasePageCollection) { basePageListTable.Rows.Add(page); } List <string> hiddenColumns = new List <string>(); foreach (PropertyInfo property in typeof(DataRowComponents).GetProperties()) { Type type = property.PropertyType; DisplayNameAttribute[] propertyArrey = (DisplayNameAttribute[]) (property.GetCustomAttributes(typeof(DisplayNameAttribute), true)); HidePropertyAttribute[] hidePropertyArrey = (HidePropertyAttribute[]) (property.GetCustomAttributes(typeof(HidePropertyAttribute), true)); DataColumn col; if (propertyArrey.Count() != 0) { col = new DataColumn(propertyArrey.First().DisplayName, type); } else { col = new DataColumn(property.Name, type); } dataTable.Columns.Add(col); if (hidePropertyArrey.Count() != 0 && hidePropertyArrey.First().IsHidden) { hiddenColumns.Add(col.ColumnName); } } DataColumn dataSource = new DataColumn("DataSource", typeof(DataRowComponents)); dataTable.Columns.Add(dataSource); foreach (DataRowComponents row in dataRowCollection) { dataTable.Rows.Add(row.IsSelected, row.Text, row.ClassName, row.Namespace, row.BasePage, row.Tag, row); } dataSet.Tables.Add(dataTable); dataSet.Tables.Add(basePageListTable); DataColumn child = dataSet.Tables["DataRowComponentsCollection"].Columns["Custom base page"]; DataColumn parent = dataSet.Tables["BasePageListTable"].Columns["BasePage"]; parent.Unique = true; ForeignKeyConstraint fk = new ForeignKeyConstraint("FK_BasePage", parent, child); dataSet.Tables["DataRowComponentsCollection"].Constraints.Add(fk); dataSet.Relations.Add("BasePage", parent, child); DataRelationCollection relationCollection = dataSet.Relations; SortedList <string, DataRelation> relCollection = new SortedList <string, DataRelation>(); foreach (DataRelation rel in relationCollection) { if (rel.ChildTable.TableName == "DataRowComponentsCollection") { relCollection.Add(rel.ChildColumns.First().ColumnName, rel); } } GridView gridview = new GridView(); listview.DataContext = dataTable; Binding bind = new Binding(); listview.ItemsSource = dataTable as IEnumerable; foreach (DataColumn col in dataTable.Columns) { GridViewColumn gvcolumn = new GridViewColumn(); gvcolumn.Header = col.ColumnName; if (hiddenColumns.Contains(col.ColumnName)) { gvcolumn.Width = 0; } if (relCollection.Keys.Contains(col.ColumnName)) { DataColumn parentColumn = relCollection.Where(p => p.Key == col.ColumnName) .Select(p => p.Value).First().ParentColumns.First(); DataTemplate dtCombo = new DataTemplate(); dtCombo.DataType = typeof(String); FrameworkElementFactory fefCombo = new FrameworkElementFactory(typeof(ComboBox)); Binding bdCombo = new Binding(col.ColumnName); List <string> basePagesList = new List <string>(); foreach (DataRow comboRow in parentColumn.Table.Rows) { basePagesList.Add(comboRow.ItemArray.First().ToString()); } ComboBox templateComboBox = new ComboBox(); templateComboBox.FontSize = 12; fefCombo.SetValue(ComboBox.ItemsSourceProperty, basePagesList); fefCombo.SetValue(ComboBox.BackgroundProperty, TransparentBrush); fefCombo.SetValue(ComboBox.ForegroundProperty, new SolidColorBrush(Colors.Goldenrod)); fefCombo.SetValue(ComboBox.BorderBrushProperty, TransparentBrush); fefCombo.SetValue(ComboBox.FontSizeProperty, templateComboBox.FontSize); fefCombo.SetBinding(ComboBox.SelectedItemProperty, bdCombo); dtCombo.VisualTree = fefCombo; gvcolumn.CellTemplate = dtCombo; gridview.Columns.Add(gvcolumn); } else if (col.DataType == typeof(bool)) { DataTemplate dtCheckbox = new DataTemplate(); dtCheckbox.DataType = typeof(Boolean); FrameworkElementFactory fefCheckbox = new FrameworkElementFactory(typeof(CheckBox)); Binding bdCheckbox = new Binding(col.ColumnName); fefCheckbox.SetBinding(CheckBox.IsCheckedProperty, bdCheckbox); dtCheckbox.VisualTree = fefCheckbox; gvcolumn.CellTemplate = dtCheckbox; gridview.Columns.Add(gvcolumn); } else if (col.DataType == typeof(string)) { DataTemplate dtTextBox = new DataTemplate(); dtTextBox.DataType = typeof(string); FrameworkElementFactory fefTextBox = new FrameworkElementFactory(typeof(TextBox)); Binding bdTextBox = new Binding(col.ColumnName); Binding bdIsTextBoxReadOnly = new Binding("Existing jaz files"); fefTextBox.SetBinding(TextBox.TextProperty, bdTextBox); TextBox templateTB = new TextBox(); templateTB.FontSize = 12; if (col.ColumnName == "Path to file") { fefTextBox.SetValue(TextBox.IsReadOnlyProperty, true); } else { fefTextBox.SetBinding(TextBox.IsReadOnlyProperty, bdIsTextBoxReadOnly); } fefTextBox.SetValue(TextBox.BackgroundProperty, TransparentBrush); fefTextBox.SetValue(TextBox.ForegroundProperty, new SolidColorBrush(Colors.Goldenrod)); fefTextBox.SetValue(TextBox.FontSizeProperty, templateTB.FontSize); fefTextBox.SetValue(TextBox.BorderBrushProperty, TransparentBrush); dtTextBox.VisualTree = fefTextBox; gvcolumn.CellTemplate = dtTextBox; gridview.Columns.Add(gvcolumn); } else { gvcolumn.Width = 0; gridview.Columns.Add(gvcolumn); } } GridViewColumn buttonDetailColumn = new GridViewColumn(); DataTemplate dtButtonDetail = new DataTemplate(); dtButtonDetail.DataType = typeof(String); Button templateButton = new Button(); templateButton.Width = 50; FrameworkElementFactory fefForButton = new FrameworkElementFactory(typeof(Button)); fefForButton.SetValue(Button.ContentProperty, "..."); fefForButton.SetValue(Button.WidthProperty, templateButton.Width); Binding bdButton = new Binding(dataTable.Columns["DataSource"].ColumnName); fefForButton.SetBinding(Button.TagProperty, bdButton); fefForButton.AddHandler(Button.ClickEvent, new RoutedEventHandler(innerButtonInListView_Click)); Binding bindButtonDetail = new Binding(); fefForButton.SetBinding(TextBox.NameProperty, bindButtonDetail); dtButtonDetail.VisualTree = fefForButton; buttonDetailColumn.CellTemplate = dtButtonDetail; #region DataGrid menu ContextMenu contextMenuVisibleColumns = new ContextMenu(); MenuItem existingJazFiles = new MenuItem() { Header = "Existing Jaz files", IsEnabled = false }; MenuItem path = new MenuItem() { Header = "Path to page", IsEnabled = false }; MenuItem classNameMenuItem = new MenuItem() { Header = "Class name" }; MenuItem namespaceMenuItem = new MenuItem() { Header = "Namespace" }; MenuItem basePageMenuItem = new MenuItem() { Header = "Base page" }; contextMenuVisibleColumns.Items.Add(existingJazFiles); contextMenuVisibleColumns.Items.Add(path); contextMenuVisibleColumns.Items.Add(classNameMenuItem); contextMenuVisibleColumns.Items.Add(namespaceMenuItem); contextMenuVisibleColumns.Items.Add(basePageMenuItem); foreach (MenuItem contextItem in contextMenuVisibleColumns.Items) { contextItem.IsCheckable = true; contextItem.IsChecked = true; contextItem.Checked += new RoutedEventHandler(contextMenuStripDataGridView_CheckedChanged); contextItem.Unchecked += new RoutedEventHandler(contextMenuStripDataGridView_CheckedChanged); switch (contextItem.Header.ToString()) { case "Class name": contextItem.Tag = "Guessed class name"; break; case "Namespace": contextItem.Tag = "Guessed namespace"; break; case "Base page": contextItem.Tag = "Custom base page"; break; } } #endregion FrameworkElementFactory fefHeaderMenuButton = new FrameworkElementFactory(typeof(Button)); fefHeaderMenuButton.SetValue(Button.ContentProperty, "Details"); fefHeaderMenuButton.SetValue(Button.ContextMenuProperty, contextMenuVisibleColumns); fefHeaderMenuButton.SetValue(Button.BackgroundProperty, TransparentBrush); fefHeaderMenuButton.SetValue(Button.BorderBrushProperty, TransparentBrush); DataTemplate dtHeaderMenuButton = new DataTemplate(); dtHeaderMenuButton.VisualTree = fefHeaderMenuButton; buttonDetailColumn.HeaderTemplate = dtHeaderMenuButton; gridview.Columns.Add(buttonDetailColumn); listview.View = gridview; listview.SetBinding(ListView.ItemsSourceProperty, bind); listview.Focus(); #endregion //Content = listview; } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); } } }
/* * if (bingoTable.printCallList == true) { printBingoCallList(pt, sz, bingoTable, Color.Black, ref graphicsObj, licenseInfo, "Oranges are pink", false); //print the call list here - msk } bingoTable.RandSeed = 0; * */ public BingoPrint() { printBingoDocument = new PrintDocument(); //printCallList = new PrintDocument(); printBingoPreviewDialog = new PrintPreviewDialog(); printBingoDialog = new PrintDialog(); pageBingoSetupDialog = new PageSetupDialog(); PrintPageSettings = new PageSettings(); printBingoDocument.PrintPage += new PrintPageEventHandler(this.PrintPage); // printCallList.PrintPage += new PrintPageEventHandler(this.PrintCallList); //printBingoDocument.QueryPageSettings += new QueryPageSettingsEventHandler(this.QueryPageSettings); numCardsToPrint = 0; return; }
/// <summary> /// Initializes a new instance of the <see cref='PrintPageEventArgs'/> class. /// </summary> public PrintPageEventArgs(Graphics graphics, Rectangle marginBounds, Rectangle pageBounds, PageSettings pageSettings) { _graphics = graphics; // may be null, see PrintController _marginBounds = marginBounds; _pageBounds = pageBounds; _pageSettings = pageSettings; }
/// <summary> /// The BindData helper method is used to update the tab's /// layout panes with the current configuration information /// </summary> private void BindData() { PageSettings page = portalSettings.ActivePage; // Populate Page Names, etc. tabName.Text = page.PageName; mobilePageName.Text = page.MobilePageName; showMobile.Checked = page.ShowMobile; // Populate the "ParentPage" Data PagesDB t = new PagesDB(); IList <PageItem> items = t.GetPagesParent(portalSettings.PortalID, PageID); parentPage.DataSource = items; parentPage.DataBind(); if (parentPage.Items.FindByValue(page.ParentPageID.ToString()) != null) { //parentPage.Items.FindByValue( tab.ParentPageID.ToString() ).Selected = true; parentPage.SelectedValue = page.ParentPageID.ToString(); } // Translate if (parentPage.Items.FindByText(" ROOT_LEVEL") != null) { parentPage.Items.FindByText(" ROOT_LEVEL").Text = General.GetString("ROOT_LEVEL", "Root Level", parentPage); } // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this tab UsersDB users = new UsersDB(); IList <RainbowRole> roles = users.GetPortalRoles(portalSettings.PortalAlias); // Clear existing items in checkboxlist authRoles.Items.Clear(); foreach (RainbowRole role in roles) { ListItem item = new ListItem(); item.Text = role.Name; item.Value = role.Id.ToString(); if ((page.AuthorizedRoles.LastIndexOf(item.Text)) > -1) { item.Selected = true; } authRoles.Items.Add(item); } // Populate the "Add Module" Data ModulesDB m = new ModulesDB(); SqlDataReader drCurrentModuleDefinitions = m.GetCurrentModuleDefinitions(portalSettings.PortalID); try { while (drCurrentModuleDefinitions.Read()) { if (PortalSecurity.IsInRoles("Admins") == true || !(bool.Parse(drCurrentModuleDefinitions["Admin"].ToString()))) { moduleType.Items.Add( new ListItem(drCurrentModuleDefinitions["FriendlyName"].ToString(), drCurrentModuleDefinitions["ModuleDefID"].ToString())); } } } finally { drCurrentModuleDefinitions.Close(); } // Populate Right Hand Module Data rightList = GetModules("RightPane"); rightPane.DataBind(); // Populate Content Pane Module Data contentList = GetModules("ContentPane"); contentPane.DataBind(); // Populate Left Hand Pane Module Data leftList = GetModules("LeftPane"); leftPane.DataBind(); }
public PortsDiagramViewModel() { #region DiagramViewModel Properties , Commands Initialization ItemUnSelectedCommand = new Command(OnItemUnselectedCommand); ItemSelectedCommand = new Command(OnItemSelectedCommand); Theme = new SimpleTheme(); DefaultConnectorType = ConnectorType.Orthogonal; ScrollSettings = new ScrollSettings() { ScrollLimit = ScrollLimit.Diagram, }; SnapSettings = new SnapSettings() { SnapConstraints = SnapConstraints.All, SnapToObject = SnapToObject.All, }; HorizontalRuler = new Ruler(); VerticalRuler = new Ruler() { Orientation = Orientation.Vertical, }; PageSettings = new PageSettings() { PageBackground = new SolidColorBrush(Colors.Transparent), PageBorderBrush = new SolidColorBrush(Colors.Transparent), }; SelectedItems = new SelectorViewModel() { SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands | SelectorConstraints.HideDisabledResizer, }; #endregion #region Node Creation NodeViewModel Node1 = CreateNode(65, 100, 200, 150, "Rectangle", "Publisher", true); NodeViewModel Node2 = CreateNode(65, 100, 450, 150, "Rectangle", "Completed Book", false); NodeViewModel Node3 = CreateNode(65, 100, 700, 150, "Rectangle", "Board", false); NodeViewModel Node4 = CreateNode(65, 100, 450, 300, "Decision", "1st Review", false); NodeViewModel Node5 = CreateNode(65, 100, 700, 300, "Decision", "Approval", false); NodeViewModel Node6 = CreateNode(65, 100, 450, 450, "Rectangle", "Legal Terms", false); NodeViewModel Node7 = CreateNode(65, 100, 450, 600, "Decision", "2nd Review", false); #endregion #region Port Creation CreateNodePort(Node1, "NodePort11", 0, 0.5, "In"); CreateNodePort(Node1, "NodePort12", 1, 0.5, "Out"); CreateNodePort(Node1, "NodePort13", 0.25, 1, "In"); CreateNodePort(Node1, "NodePort14", 0.5, 1, "Out"); CreateNodePort(Node1, "NodePort15", 0.75, 1, "In"); CreateNodePort(Node2, "NodePort21", 0, 0.5, "In"); CreateNodePort(Node2, "NodePort22", 0.5, 1, "Out"); CreateNodePort(Node2, "NodePort23", 1, 0.4, "Out"); CreateNodePort(Node2, "NodePort24", 1, 0.6, "In"); CreateNodePort(Node3, "NodePort31", 0, 0.4, "In"); CreateNodePort(Node3, "NodePort32", 0.5, 1, "Out"); CreateNodePort(Node4, "NodePort41", 0, 0.5, "Out"); CreateNodePort(Node4, "NodePort42", 0.5, 0, "In"); CreateNodePort(Node4, "NodePort43", 0.5, 1, "Out"); CreateNodePort(Node5, "NodePort51", 0.5, 0, "In"); CreateNodePort(Node5, "NodePort52", 0.5, 1, "Out"); CreateNodePort(Node6, "NodePort61", 0, 0.5, "In"); CreateNodePort(Node6, "NodePort62", 0.5, 0, "In"); CreateNodePort(Node6, "NodePort63", 0.5, 1, "Out"); CreateNodePort(Node7, "NodePort71", 0, 0.5, "Out"); CreateNodePort(Node7, "NodePort72", 0.5, 0, "In"); CreateNodePort(Node7, "NodePort73", 1, 0.5, "Out"); #endregion #region NodeCollection (Nodes as NodeCollection).Add(Node1); (Nodes as NodeCollection).Add(Node2); (Nodes as NodeCollection).Add(Node3); (Nodes as NodeCollection).Add(Node4); (Nodes as NodeCollection).Add(Node5); (Nodes as NodeCollection).Add(Node6); (Nodes as NodeCollection).Add(Node7); #endregion }
public void Print(FileInfo file, PrinterSettings printerSettings, PageSettings pageSettings) { var bmp = Bitmap.FromFile(file.FullName); void ppp(object sender, PrintPageEventArgs e) { var newWidth = bmp.Width * 100 / bmp.HorizontalResolution; var newHeight = bmp.Height * 100 / bmp.VerticalResolution; var widthFactor = (pageSettings.Landscape) ? newWidth / e.PageSettings.PrintableArea.Height : newWidth / e.PageSettings.PrintableArea.Width; var HeightFactor = (pageSettings.Landscape) ? newHeight / e.PageSettings.PrintableArea.Width : newHeight / e.PageSettings.PrintableArea.Height; var widthMargin = 0; var heightMargin = 0; if (widthFactor > 1 || HeightFactor > 1) { if (widthFactor > HeightFactor) { newWidth /= widthFactor; newHeight /= widthFactor; } else { newWidth /= HeightFactor; newHeight /= HeightFactor; } } if (pageSettings.Landscape) { heightMargin = (int)((e.PageSettings.PrintableArea.Height - newHeight) / 2) / 2; } else { widthMargin = (int)((e.PageSettings.PrintableArea.Width - newWidth) / 2) / 2; } var h = e.PageSettings.PrintableArea.Height; var m = (e.PageSettings.PrintableArea.Height - h) / 2; e.Graphics.DrawImage(bmp, (e.PageSettings.HardMarginX + widthMargin), (e.PageSettings.HardMarginY + heightMargin), newWidth, newHeight); } var printDoc = new PrintDocument { DefaultPageSettings = pageSettings }; if (!file.Exists) { return; } printDoc.PrinterSettings = printerSettings; printDoc.PrintPage += ppp; printDoc.Print(); bmp.Dispose(); }
public SfDiagram_Binding_With_TreeView_ViewModel() { #region Commands AddNode = new DelegateCommand(OnAddNode); DeleteNode = new DelegateCommand(OnDeleteNode); ItemAddedCommand = new DelegateCommand(OnItemAdded); ItemDeletingCommand = new DelegateCommand(OnItemDeleting); ItemSelectedCommand = new DelegateCommand(OnItemSelected); ItemUnSelectedCommand = new DelegateCommand(OnItemUnSelected); #endregion #region Initialize Properties Tool = Tool.SingleSelect; Datas = new ObservableCollection <Items>() { new Items() { Name = "Plant Manager", ID = 1, SubItems = new ObservableCollection <Items>() { new Items() { Name = "Production Manager", ID = 2, ParentID = 1, SubItems = new ObservableCollection <Items>() { new Items() { Name = "Control Room", ID = 3, ParentID = 2, SubItems = new ObservableCollection <Items>() { new Items() { Name = "Foreman1", ID = 4, ParentID = 3, SubItems = new ObservableCollection <Items>() { new Items() { Name = "Craft Personnel5", ID = 5, ParentID = 4 }, new Items() { Name = "Craft Personnel6", ID = 6, ParentID = 4 }, }, }, }, }, new Items() { Name = "Plant Operator", ID = 7, ParentID = 2, SubItems = new ObservableCollection <Items>() { new Items() { Name = "Foreman2", ID = 8, ParentID = 7, SubItems = new ObservableCollection <Items>() { new Items() { Name = "Craft Personnel7", ID = 9, ParentID = 8 }, }, }, }, }, }, }, new Items() { Name = "Administrative Officer", ID = 10, ParentID = 1 }, new Items() { Name = "Maintenance Manager", ID = 11, ParentID = 1, SubItems = new ObservableCollection <Items>() { new Items() { Name = "Electrical Supervisor", ID = 12, ParentID = 11, SubItems = new ObservableCollection <Items>() { new Items() { Name = "Craft Personnel1", ID = 13, ParentID = 12 }, new Items() { Name = "Craft Personnel2", ID = 14, ParentID = 12 }, }, }, new Items() { Name = "Mechanical Supervisor", ID = 15, ParentID = 11, SubItems = new ObservableCollection <Items>() { new Items() { Name = "Craft Personnel3", ID = 16, ParentID = 15 }, new Items() { Name = "Craft Personnel4", ID = 17, ParentID = 15 }, }, }, }, }, }, }, }; DefaultConnectorType = ConnectorType.Orthogonal; PageSettings = new PageSettings() { PageBackground = new SolidColorBrush(Colors.Transparent), PageBorderBrush = new SolidColorBrush(Colors.Transparent), }; SelectedItems = new SelectorViewModel() { SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands & ~SelectorConstraints.Rotator & ~SelectorConstraints.Tooltip & ~SelectorConstraints.Pivot, }; LayoutManager = new Syncfusion.UI.Xaml.Diagram.Layout.LayoutManager() { Layout = new DirectedTreeLayout() { HorizontalSpacing = 20, VerticalSpacing = 40, Orientation = TreeOrientation.TopToBottom, Type = LayoutType.Hierarchical, }, RefreshFrequency = RefreshFrequency.ArrangeParsing, }; DataSourceSettings = new DataSourceSettings() { Id = "ID", ParentId = "ParentID", DataSource = GetData(Datas), }; #endregion }
public override void RebuildIndex( PageSettings pageSettings, string indexPath) { bool disableSearchIndex = ConfigHelper.GetBoolProperty("DisableSearchIndex", false); if (disableSearchIndex) { return; } if (pageSettings == null) { log.Error("pageSettings passed in to HtmlContentIndexBuilderProvider.RebuildIndex was null"); return; } //don't index pending/unpublished pages if (pageSettings.IsPending) { return; } log.Info("HtmlContentIndexBuilderProvider indexing page - " + pageSettings.PageName); try { Guid htmlFeatureGuid = new Guid("881e4e00-93e4-444c-b7b0-6672fb55de10"); ModuleDefinition htmlFeature = new ModuleDefinition(htmlFeatureGuid); List <PageModule> pageModules = PageModule.GetPageModulesByPage(pageSettings.PageId); HtmlRepository repository = new HtmlRepository(); DataTable dataTable = repository.GetHtmlContentByPage( pageSettings.SiteId, pageSettings.PageId); foreach (DataRow row in dataTable.Rows) { bool includeInSearch = Convert.ToBoolean(row["IncludeInSearch"]); bool excludeFromRecentContent = Convert.ToBoolean(row["ExcludeFromRecentContent"]); IndexItem indexItem = new IndexItem(); indexItem.ExcludeFromRecentContent = excludeFromRecentContent; indexItem.SiteId = pageSettings.SiteId; indexItem.PageId = pageSettings.PageId; indexItem.PageName = pageSettings.PageName; string authorName = row["CreatedByName"].ToString(); string authorFirstName = row["CreatedByFirstName"].ToString(); string authorLastName = row["CreatedByLastName"].ToString(); if ((authorFirstName.Length > 0) && (authorLastName.Length > 0)) { indexItem.Author = string.Format(CultureInfo.InvariantCulture, Resource.FirstNameLastNameFormat, authorFirstName, authorLastName); } else { indexItem.Author = authorName; } if (!includeInSearch) { indexItem.RemoveOnly = true; } // generally we should not include the page meta because it can result in duplicate results // one for each instance of html content on the page because they all use the smae page meta. // since page meta should reflect the content of the page it is sufficient to just index the content if (WebConfigSettings.IndexPageKeywordsWithHtmlArticleContent) { indexItem.PageMetaDescription = pageSettings.PageMetaDescription; indexItem.PageMetaKeywords = pageSettings.PageMetaKeyWords; } indexItem.ViewRoles = pageSettings.AuthorizedRoles; indexItem.ModuleViewRoles = row["ViewRoles"].ToString(); if (pageSettings.UseUrl) { if (pageSettings.UrlHasBeenAdjustedForFolderSites) { indexItem.ViewPage = pageSettings.UnmodifiedUrl.Replace("~/", string.Empty); } else { indexItem.ViewPage = pageSettings.Url.Replace("~/", string.Empty); } indexItem.UseQueryStringParams = false; } indexItem.FeatureId = htmlFeatureGuid.ToString(); indexItem.FeatureName = htmlFeature.FeatureName; indexItem.FeatureResourceFile = htmlFeature.ResourceFile; indexItem.ItemId = Convert.ToInt32(row["ItemID"]); indexItem.ModuleId = Convert.ToInt32(row["ModuleID"]); indexItem.ModuleTitle = row["ModuleTitle"].ToString(); indexItem.Title = row["Title"].ToString(); // added the remove markup 2010-01-30 because some javascript strings like ]]> were apearing in search results if the content conatined jacvascript indexItem.Content = SecurityHelper.RemoveMarkup(row["Body"].ToString()); indexItem.CreatedUtc = Convert.ToDateTime(row["CreatedDate"]); indexItem.LastModUtc = Convert.ToDateTime(row["LastModUtc"]); // lookup publish dates foreach (PageModule pageModule in pageModules) { if (indexItem.ModuleId == pageModule.ModuleId) { indexItem.PublishBeginDate = pageModule.PublishBeginDate; indexItem.PublishEndDate = pageModule.PublishEndDate; } } IndexHelper.RebuildIndex(indexItem, indexPath); log.Debug("Indexed " + indexItem.Title); } } catch (System.Data.Common.DbException ex) { log.Error(ex); } }
protected virtual void UpdateTabInfoFromPageSettings(TabInfo tab, PageSettings pageSettings) { tab.TabName = pageSettings.Name; tab.TabPath = Globals.GenerateTabPath(tab.ParentId, tab.TabName); tab.Title = pageSettings.Title; tab.Description = GetTabDescription(pageSettings); tab.KeyWords = GetKeyWords(pageSettings); tab.IsVisible = pageSettings.IncludeInMenu; tab.StartDate = pageSettings.StartDate ?? Null.NullDate; tab.EndDate = pageSettings.EndDate ?? Null.NullDate; tab.IsSecure = pageSettings.IsSecure; tab.TabSettings["AllowIndex"] = pageSettings.AllowIndex; tab.SiteMapPriority = pageSettings.SiteMapPriority; tab.PageHeadText = pageSettings.PageHeadText; tab.PermanentRedirect = pageSettings.PermanentRedirect; tab.Url = GetInternalUrl(pageSettings); tab.TabSettings["CacheProvider"] = pageSettings.CacheProvider; if (pageSettings.CacheProvider != null) { tab.TabSettings["CacheDuration"] = pageSettings.CacheDuration; if (pageSettings.CacheIncludeExclude.HasValue) { if (pageSettings.CacheIncludeExclude.Value) { tab.TabSettings["CacheIncludeExclude"] = "1"; tab.TabSettings["IncludeVaryBy"] = null; tab.TabSettings["ExcludeVaryBy"] = pageSettings.CacheExcludeVaryBy; } else { tab.TabSettings["CacheIncludeExclude"] = "0"; tab.TabSettings["IncludeVaryBy"] = pageSettings.CacheIncludeVaryBy; tab.TabSettings["ExcludeVaryBy"] = null; } tab.TabSettings["MaxVaryByCount"] = pageSettings.CacheMaxVaryByCount; } } else { tab.TabSettings["CacheDuration"] = null; tab.TabSettings["CacheIncludeExclude"] = null; tab.TabSettings["IncludeVaryBy"] = null; tab.TabSettings["ExcludeVaryBy"] = null; tab.TabSettings["MaxVaryByCount"] = null; } tab.TabSettings["LinkNewWindow"] = pageSettings.LinkNewWindow; tab.TabSettings["CustomStylesheet"] = pageSettings.PageStyleSheet; // Tab Skin tab.SkinSrc = GetSkinSrc(pageSettings); tab.ContainerSrc = GetContainerSrc(pageSettings); if (pageSettings.PageType == "template") { tab.ParentId = GetTemplateParentId(tab.PortalID); tab.IsSystem = true; } tab.Terms.Clear(); if (!string.IsNullOrEmpty(pageSettings.Tags)) { tab.Terms.Clear(); var termController = new TermController(); var vocabularyController = Util.GetVocabularyController(); var vocabulary = (vocabularyController.GetVocabularies() .Cast <Vocabulary>() .Where(v => v.Name == PageTagsVocabulary)) .SingleOrDefault(); int vocabularyId; if (vocabulary == null) { var scopeType = Util.GetScopeTypeController().GetScopeTypes().SingleOrDefault(s => s.ScopeType == "Portal"); if (scopeType == null) { throw new Exception("Can't create default vocabulary as scope type 'Portal' can't finded."); } vocabularyId = vocabularyController.AddVocabulary( new Vocabulary(PageTagsVocabulary, string.Empty, VocabularyType.Simple) { ScopeTypeId = scopeType.ScopeTypeId, ScopeId = tab.PortalID }); } else { vocabularyId = vocabulary.VocabularyId; } //get all terms info var allTerms = new List <Term>(); var vocabularies = from v in vocabularyController.GetVocabularies() where (v.ScopeType.ScopeType == "Portal" && v.ScopeId == tab.PortalID && !v.Name.Equals("Tags", StringComparison.InvariantCultureIgnoreCase)) select v; foreach (var v in vocabularies) { allTerms.AddRange(termController.GetTermsByVocabulary(v.VocabularyId)); } foreach (var tag in pageSettings.Tags.Trim().Split(',')) { if (!string.IsNullOrEmpty(tag)) { var term = allTerms.FirstOrDefault(t => t.Name.Equals(tag, StringComparison.InvariantCultureIgnoreCase)); if (term == null) { var termId = termController.AddTerm(new Term(tag, string.Empty, vocabularyId)); term = termController.GetTerm(termId); } tab.Terms.Add(term); } } } }
private static void IndexItem(CalendarEvent calendarEvent) { if (WebConfigSettings.DisableSearchIndex) { return; } if (calendarEvent == null) { return; } try { //SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings(); //if ((siteSettings == null) // || (calendarEvent == null)) //{ // return; //} Module module = new Module(calendarEvent.ModuleId); Guid calendarFeatureGuid = new Guid("c5e6a5df-ac2a-43d3-bb7f-9739bc47194e"); ModuleDefinition calendarFeature = new ModuleDefinition(calendarFeatureGuid); // get list of pages where this module is published List <PageModule> pageModules = PageModule.GetPageModulesByModule(calendarEvent.ModuleId); foreach (PageModule pageModule in pageModules) { PageSettings pageSettings = new PageSettings( calendarEvent.SiteId, pageModule.PageId); //don't index pending/unpublished pages if (pageSettings.IsPending) { continue; } mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem(); if (calendarEvent.SearchIndexPath.Length > 0) { indexItem.IndexPath = calendarEvent.SearchIndexPath; } indexItem.SiteId = calendarEvent.SiteId; indexItem.PageId = pageSettings.PageId; indexItem.PageName = pageSettings.PageName; indexItem.ViewRoles = pageSettings.AuthorizedRoles; indexItem.ModuleViewRoles = module.ViewRoles; indexItem.ItemId = calendarEvent.ItemId; indexItem.ModuleId = calendarEvent.ModuleId; indexItem.ViewPage = "EventCalendar/EventDetails.aspx"; indexItem.FeatureId = calendarFeatureGuid.ToString(); indexItem.FeatureName = calendarFeature.FeatureName; indexItem.FeatureResourceFile = calendarFeature.ResourceFile; indexItem.ModuleTitle = module.ModuleTitle; indexItem.Title = calendarEvent.Title; indexItem.Content = calendarEvent.Description; indexItem.PublishBeginDate = pageModule.PublishBeginDate; indexItem.PublishEndDate = pageModule.PublishEndDate; indexItem.CreatedUtc = calendarEvent.CreatedDate; indexItem.LastModUtc = calendarEvent.LastModUtc; mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem); } if (debugLog) { log.Debug("Indexed " + calendarEvent.Title); } } catch (System.Data.Common.DbException ex) { log.Error("CalendarEventIndexBuilderProvider.IndexItem", ex); } }
public void SaveTabUrl(TabInfo tab, PageSettings pageSettings) { if (!pageSettings.CustomUrlEnabled) { return; } if (tab.IsSuperTab) { return; } var url = pageSettings.Url; var tabUrl = tab.TabUrls.SingleOrDefault(t => t.IsSystem && t.HttpStatus == "200" && t.SeqNum == 0); var portalSettings = PortalController.Instance.GetCurrentPortalSettings(); if (!String.IsNullOrEmpty(url) && url != "/") { url = CleanTabUrl(url); string currentUrl = String.Empty; var friendlyUrlSettings = new FriendlyUrlSettings(portalSettings.PortalId); if (tab.TabID > -1) { var baseUrl = Globals.AddHTTP(portalSettings.PortalAlias.HTTPAlias) + "/Default.aspx?TabId=" + tab.TabID; var path = AdvancedFriendlyUrlProvider.ImprovedFriendlyUrl(tab, baseUrl, Globals.glbDefaultPage, portalSettings.PortalAlias.HTTPAlias, false, friendlyUrlSettings, Guid.Empty); currentUrl = path.Replace(Globals.AddHTTP(portalSettings.PortalAlias.HTTPAlias), ""); } if (url == currentUrl) { return; } if (tabUrl == null) { //Add new custom url tabUrl = new TabUrlInfo { TabId = tab.TabID, SeqNum = 0, PortalAliasId = -1, PortalAliasUsage = PortalAliasUsageType.Default, QueryString = String.Empty, Url = url, HttpStatus = "200", CultureCode = String.Empty, IsSystem = true }; //Save url _tabController.SaveTabUrl(tabUrl, portalSettings.PortalId, true); } else { //Change the original 200 url to a redirect tabUrl.HttpStatus = "301"; tabUrl.SeqNum = tab.TabUrls.Max(t => t.SeqNum) + 1; _tabController.SaveTabUrl(tabUrl, portalSettings.PortalId, true); //Add new custom url tabUrl.Url = url; tabUrl.HttpStatus = "200"; tabUrl.SeqNum = 0; _tabController.SaveTabUrl(tabUrl, portalSettings.PortalId, true); } //Delete any redirects to the same url foreach (var redirecturl in _tabController.GetTabUrls(tab.TabID, tab.PortalID)) { if (redirecturl.Url == url && redirecturl.HttpStatus != "200") { _tabController.DeleteTabUrl(redirecturl, tab.PortalID, true); } } } else { if (tabUrl != null) { _tabController.DeleteTabUrl(tabUrl, portalSettings.PortalId, true); } } }
// Due to the nature of PRINTDLGEX vs PRINTDLG, separate but similar methods // are required for updating the settings from the structure utilized by the dialog. // Take information from print dialog and put in PrinterSettings private static void UpdatePrinterSettings(IntPtr hDevMode, IntPtr hDevNames, short copies, int flags, PrinterSettings settings, PageSettings pageSettings) { // Mode settings.SetHdevmode(hDevMode); settings.SetHdevnames(hDevNames); if (pageSettings != null) { pageSettings.SetHdevmode(hDevMode); } //Check for Copies == 1 since we might get the Right number of Copies from hdevMode.dmCopies... if (settings.Copies == 1) { settings.Copies = copies; } settings.PrintRange = (PrintRange)(flags & printRangeMask); }
private List <IndexItem> GetRecentContent() { List <IndexItem> recentContent = null; if (pageId == -1) { return(recentContent); } if (moduleId == -1) { return(recentContent); } pageSettings = CacheHelper.GetCurrentPage(); module = GetModule(); if (module != null) { moduleSettings = ModuleSettings.GetModuleSettings(moduleId); config = new RecentContentConfiguration(moduleSettings); shouldRender = config.EnableFeed; if (!shouldRender) { return(null); } bool shouldRedirectToFeedburner = false; if (config.FeedburnerFeedUrl.Length > 0) { shouldRedirectToFeedburner = true; if ((Request.UserAgent != null) && (Request.UserAgent.Contains("FeedBurner"))) { shouldRedirectToFeedburner = false; // don't redirect if the feedburner bot is reading the feed } Guid redirectBypassToken = WebUtils.ParseGuidFromQueryString("r", Guid.Empty); if (redirectBypassToken == Global.FeedRedirectBypassToken) { shouldRedirectToFeedburner = false; // allows time for user to subscribe to autodiscovery links without redirecting } } if (shouldRedirectToFeedburner) { redirectUrl = config.FeedburnerFeedUrl; shouldRender = false; return(null); } feedCacheTimeInMinutes = config.FeedCacheTimeInMinutes; channelTitle = config.FeedChannelTitle; channelLink = WebUtils.ResolveServerUrl(SiteUtils.GetCurrentPageUrl()); channelDescription = config.FeedChannelDescription; channelCopyright = config.FeedChannelCopyright; channelManagingEditor = config.FeedChannelManagingEditor; channelTimeToLive = config.FeedTimeToLiveInMinutes; if (config.GetCreated) { recentContent = IndexHelper.GetRecentCreatedContent( siteSettings.SiteId, config.GetFeatureGuids(), DateTime.UtcNow.AddDays(-config.MaxDaysOldRecentItemsToGet), config.MaxRecentItemsToGet); } else { recentContent = IndexHelper.GetRecentModifiedContent( siteSettings.SiteId, config.GetFeatureGuids(), DateTime.UtcNow.AddDays(-config.MaxDaysOldRecentItemsToGet), config.MaxRecentItemsToGet); } } return(recentContent); }
public System.Drawing.Graphics CreateMeasurementGraphics(PageSettings pageSettings, bool honorOriginAtMargins) {}
/// <summary> /// Print RDLC File /// </summary> /// <returns></returns> public bool Print() { this.pageIndex = 0; this.pageStreams.Clear(); ReportPageSettings rps = this.localReport.GetDefaultPageSettings(); float pageWidth = 0f; float pageHeight = 0f; float marginTop = rps.Margins.Top / 100f; float marginLeft = rps.Margins.Left / 100f; float marginRight = rps.Margins.Right / 100f; float marginBottom = rps.Margins.Bottom / 100f; bool landscape = false; if (rps.PaperSize.Width > rps.PaperSize.Height) { pageWidth = rps.PaperSize.Width / 100f; pageHeight = rps.PaperSize.Height / 100f; landscape = false; } else { pageWidth = rps.PaperSize.Height / 100f; pageHeight = rps.PaperSize.Width / 100f; landscape = true; } string ImageDeviceInfo = string.Format(@"<DeviceInfo> <OutputFormat>EMF</OutputFormat> <PageWidth>{0}in</PageWidth> <PageHeight>{1}in</PageHeight> <MarginTop>{2}in</MarginTop> <MarginLeft>{3}in</MarginLeft> <MarginRight>{4}in</MarginRight> <MarginBottom>{5}in</MarginBottom> </DeviceInfo>", pageWidth, pageHeight, marginTop, marginLeft, marginRight, marginBottom); Warning[] warnings = null; try { this.localReport.Render("Image", ImageDeviceInfo, CreatePrintPageStream, out warnings); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (warnings != null && warnings.Length > 0) { string warnMsg = string.Empty; foreach (Warning warning in warnings) { warnMsg += string.Format("WarningCode: {0} WarningMessage: {1}\r\n", warning.Code, warning.Message); } throw new Exception(warnMsg); } if (this.pageStreams == null || this.pageStreams.Count == 0) { return(false); } try { PageSetupDialog psd = new PageSetupDialog(); PrinterSettings printset = new PrinterSettings(); XmlDocument doc = new XmlDocument(); //doc.Load(System.Configuration.ConfigurationManager.AppSettings["printset"].ToString()); string xmlFile = AppDomain.CurrentDomain.BaseDirectory + "BugsBox.Pharmacy.AppClient.printSet.xml"; doc.Load(xmlFile); string s = System.Environment.CurrentDirectory; XmlNodeList nodelist = doc.SelectNodes("/printsets/pageset"); int wt = Convert.ToInt16(nodelist[0].Attributes["width"].Value); int ht = Convert.ToInt16(nodelist[1].Attributes["height"].Value); PaperSize pse = new PaperSize("Custom", wt, ht); PageSettings pageset = new PageSettings(); int Bottom = Convert.ToInt16(nodelist[2].Attributes["top"].Value); int Top = Convert.ToInt16(nodelist[3].Attributes["left"].Value); int Left = Convert.ToInt16(nodelist[4].Attributes["right"].Value); int Right = Convert.ToInt16(nodelist[5].Attributes["bottom"].Value); Margins margin = new Margins(Left, Right, Top, Bottom); pageset.Margins = margin; pageset.PaperSize = pse; printset.DefaultPageSettings.PaperSize = pse; psd.PrinterSettings = printset; psd.PageSettings = pageset; psd.PageSettings.PaperSize = pse; this.printDocument.PrinterSettings = psd.PrinterSettings; //int printAreaWidth = Convert.ToInt16(psd.PageSettings.PrintableArea.Width); //int printAreaHeight = Convert.ToInt16(psd.PageSettings.PrintableArea.Height); //if(psd.ShowDialog()==DialogResult.Cancel)return false; //if (printAreaHeight != Convert.ToInt16(psd.PrinterSettings.DefaultPageSettings.PrintableArea.Height) || printAreaWidth != Convert.ToInt16(psd.PrinterSettings.DefaultPageSettings.PrintableArea.Width)) //{ // nodelist[0].Attributes[0].Value = (this.printDocument.DefaultPageSettings.PrintableArea.Width + this.printDocument.DefaultPageSettings.HardMarginX * 2).ToString("F0"); // nodelist[1].Attributes[0].Value = (this.printDocument.DefaultPageSettings.PrintableArea.Height +this.printDocument.DefaultPageSettings.HardMarginY*2).ToString("F0"); // nodelist[2].Attributes[0].Value = (this.printDocument.DefaultPageSettings.Margins.Top).ToString(); // nodelist[3].Attributes[0].Value = (this.printDocument.DefaultPageSettings.Margins.Left).ToString(); // nodelist[4].Attributes[0].Value = (this.printDocument.DefaultPageSettings.Margins.Right).ToString(); // nodelist[5].Attributes[0].Value = (this.printDocument.DefaultPageSettings.Margins.Bottom).ToString(); // doc.Save(System.Configuration.ConfigurationManager.AppSettings["printset"].ToString()); //} //this.printDocument.Print(); this.printPreview.Document = this.printDocument; this.printPreview.ShowDialog(); //使用image输出到文件后,可能会改变应用程序默认路径,所以。。。。。。。。 if (System.Environment.CurrentDirectory != s) { System.Environment.CurrentDirectory = s; } } catch (Exception ex) { MessageBox.Show("打印配置文件丢失,请检查!\n" + ex.Message); } return(true); }
// Constructors public PrintPageEventArgs(System.Drawing.Graphics graphics, System.Drawing.Rectangle marginBounds, System.Drawing.Rectangle pageBounds, PageSettings pageSettings) {}
/// <summary> /// Default Constructor /// </summary> /// <param name="oScintillaControl">Scintilla control being printed</param> public PrintDocument(Scintilla oScintillaControl) { this._oScintillaControl = oScintillaControl; DefaultPageSettings = new PageSettings(); }
//public static bool IsNotAllowedToEditModuleSettings //{ // get // { // if (!HttpContext.Current.Request.IsAuthenticated) return true; // if (IsAdmin) { return false; } // if (IsContentAdmin) { return false; } // if (ConfigurationManager.AppSettings["RolesNotAllowedToEditModuleSettings"] != null) // { // string forbiddenRoles = ConfigurationManager.AppSettings["RolesNotAllowedToEditModuleSettings"]; // if (!string.IsNullOrEmpty(forbiddenRoles)) // { // return IsInRoles(forbiddenRoles); // } // } // return true; // } //} public static bool HasEditPermissions(int siteId, int moduleId, int pageId) { if (HttpContext.Current == null || HttpContext.Current.User == null) return false; if (!HttpContext.Current.Request.IsAuthenticated) return false; if (IsAdmin || IsContentAdmin) return true; Module module = new Module(moduleId, pageId); PageSettings pageSettings = new PageSettings(siteId, module.PageId); if (pageSettings == null) return false; if (pageSettings.PageId < 0) return false; if (IsInRoles(pageSettings.EditRoles) || IsInRoles(module.AuthorizedEditRoles)) { return true; } if (module.EditUserId > 0) { SiteSettings siteSettings = (SiteSettings)HttpContext.Current.Items["SiteSettings"]; SiteUser siteUser = new SiteUser(siteSettings, HttpContext.Current.User.Identity.Name); if (module.EditUserId == siteUser.UserId) { return true; } } return false; }
/// <summary> /// Handles the UpdateControl event of the EditTable control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:Rainbow.Framework.Web.UI.WebControls.SettingsTableEventArgs"/> instance containing the event data.</param> protected void EditTable_UpdateControl(object sender, SettingsTableEventArgs e) { PageSettings.UpdatePageSettings(PageID, e.CurrentItem.EditControl.ID, e.CurrentItem.Value); }
// Constructors public QueryPageSettingsEventArgs(PageSettings pageSettings) { }
void btnSave_Click(object sender, EventArgs e) { string paneName = ddPaneNames.SelectedValue; DateTime beginDate = DateTime.UtcNow; DateTime endDate = DateTime.MinValue; //Boolean beginDateInvalid = false; if (!DateTime.TryParse(dpBeginDate.Text, out beginDate)) { //beginDateInvalid = true; } if (dpEndDate.Text.Length > 0) { if (!DateTime.TryParse(dpEndDate.Text, out endDate)) { endDate = DateTime.MinValue; } } else { endDate = DateTime.MinValue; } if (timeZone != null) { beginDate = beginDate.ToUtc(timeZone); if (endDate != DateTime.MinValue) { endDate = endDate.ToUtc(timeZone); } } else { beginDate = beginDate.AddHours(-timeOffset); if (endDate != DateTime.MinValue) { endDate = endDate.AddHours(-timeOffset); } } int moduleOrder = 1; int.TryParse(txtModuleOrder.Text, NumberStyles.Integer, CultureInfo.InvariantCulture, out moduleOrder); if (chkPublished.Checked) { Module.Publish( currentPage.PageGuid, currentModule.ModuleGuid, currentModule.ModuleId, pageId, paneName, moduleOrder, beginDate, endDate); } else { if (WebConfigSettings.LogIpAddressForContentDeletions) { Module m = new Module(moduleId); PageSettings contentPage = new PageSettings(CurrentSite.SiteId, pageId); string userName = string.Empty; SiteUser currentUser = SiteUtils.GetCurrentSiteUser(); if (currentUser != null) { userName = currentUser.Name; } log.Info("user " + userName + " removed module " + m.ModuleTitle + " from page " + contentPage.PageName + " from ip address " + SiteUtils.GetIP4Address()); } Module.DeleteModuleInstance(moduleId, pageId); } // rebuild page search index currentPage.PageIndex = CurrentPage.PageIndex; mojoPortal.SearchIndex.IndexHelper.RebuildPageIndexAsync(currentPage); pnlUpdate.Visible = false; pnlFinished.Visible = true; }
public void SetSize(PageSettings settings) { this.Size = new System.Drawing.Size(settings.Bounds.Width, settings.Bounds.Height); drawingImage = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height); trackerImage = (Bitmap)drawingImage.Clone(); }
public frmCartaoReportVerso(List <objMembro> MembroList) { InitializeComponent(); List <objMembro> newOrganizedList = new List <objMembro>(); //---ORGANIZE: inverse order to combine with FRONT CARD // ------------------------------------------------------------- for (int i = 0; i < 10; i++) { if (i < 5) { newOrganizedList.Add(MembroList[i + 5]); } else { newOrganizedList.Add(MembroList[i - 5]); } } // --- define REPORT DATASOURCE // ------------------------------------------------------------- _MembroList = newOrganizedList; ReportDataSource dst = new ReportDataSource("dstMembro", _MembroList); // --- define o REPORT // ------------------------------------------------------------- //--- Define Page Settings PageSettings pg = new PageSettings(); pg.Margins.Top = 10; pg.Margins.Bottom = 10; pg.Margins.Left = 30; pg.Margins.Right = 10; PaperSize size = new PaperSize("Cartao Membro", 787, 1181); pg.PaperSize = size; rptvPadrao.SetPageSettings(pg); rptvPadrao.RefreshReport(); // --- clear dataSources rptvPadrao.LocalReport.DataSources.Clear(); //--- Get and Define Temp folder to save BARCODE files TempFolder = Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData) + "\\CartaoIgreja\\PrintBarCodes"; // --- insert data EditParams(); rptvPadrao.LocalReport.DataSources.Add(dst); //--- add Parameters //addParameters(dtInicial, dtFinal); // -- display rptvPadrao.LocalReport.EnableExternalImages = true; rptvPadrao.SetDisplayMode(DisplayMode.PrintLayout); rptvPadrao.RefreshReport(); /* * var pgSet = rptvPadrao.GetPageSettings(); * MessageBox.Show($"{pgSet.PaperSize.Height} {pgSet.PaperSize.Width}"); * PrinterSettings printer = new PrinterSettings(); * MessageBox.Show(printer.GetHdevmode(rptvPadrao.PrinterSettings.DefaultPageSettings).ToString()); * size.RawKind = (int)PaperKind.A4; */ }
// Constructor. public QueryPageSettingsEventArgs(PageSettings pageSettings) { this.pageSettings = pageSettings; }
public void SetObjects(ICustomPaint[] staticElements, ICustomPaint[] dynamicElements, PageSettings thePageSettings) { staticObjects = staticElements; dynamicObjects = dynamicElements; pageSettings = thePageSettings; this.Invalidate(); }
// Update the dialog with information from the settings. void UpdateDialog() { PageSettings pageSettings = settings.PageSettings; PrinterSettings printerSettings = pageSettings.PrinterSettings; // Courses if (settings.CourseIds != null) { courseSelector.SelectedCourses = settings.CourseIds; } if (settings.AllCourses) { courseSelector.AllCoursesSelected = true; } courseSelector.VariationChoicesPerCourse = settings.VariationChoicesPerCourse; // Output section. printerName.Text = printerSettings.PrinterName; if (printerSettings.IsValid) { paperSize.Text = Util.GetPaperSizeText(pageSettings.PaperSize); orientation.Text = (pageSettings.Landscape) ? MiscText.Landscape : MiscText.Portrait; margins.Text = Util.GetMarginsText(pageSettings.Margins); } else { paperSize.Text = orientation.Text = margins.Text = ""; } // Copies section. if (settings.CountKind == PrintingCountKind.DescriptionCount) { copiesCombo.SelectedIndex = 2; descriptionsUpDown.Enabled = true; descriptionsLabel.Enabled = true; descriptionsUpDown.Value = settings.Count; } else { descriptionsUpDown.Enabled = false; descriptionsLabel.Enabled = false; if (settings.CountKind == PrintingCountKind.OneDescription) { copiesCombo.SelectedIndex = 0; } else { copiesCombo.SelectedIndex = 1; } } // Appearance section boxSizeUpDown.Value = (decimal)settings.BoxSize; if (settings.UseCourseDefault) { descriptionKindCombo.SelectedIndex = 0; } else if (settings.DescKind == DescriptionKind.Symbols) { descriptionKindCombo.SelectedIndex = 1; } else if (settings.DescKind == DescriptionKind.Text) { descriptionKindCombo.SelectedIndex = 2; } else if (settings.DescKind == DescriptionKind.SymbolsAndText) { descriptionKindCombo.SelectedIndex = 3; } }
internal ReportPrintDocument(FileManager fileManager, PageSettings pageSettings) { m_fileManager = fileManager; m_pageSettings = pageSettings; }