// Preview Images.
        private void imgPreview_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            //foreach (string imgData in Candidate.Illustration)
            //{
            //    Image image = ImageUtils.Base64StringToImage(imgData);
            //    using (Form form = new Form())
            //    {
            //        form.StartPosition = FormStartPosition.CenterScreen;
            //        form.Size = image.Size;
            //        form.FormBorderStyle = FormBorderStyle.FixedDialog;
            //        form.MaximizeBox = false;
            //        form.MinimizeBox = false;

            //        PictureBox pb = new PictureBox();
            //        pb.Dock = DockStyle.Fill;
            //        pb.Image = image;

            //        form.Controls.Add(pb);
            //        form.ShowDialog();
            //    }
            //}
            var preview = new PicturePreview(Candidate.Illustration);

            preview.Visible = true;
            preview.Show();
        }
 private void riZoomTrackBar_ValueChanged(object sender, EventArgs e)
 {
     try {
         SkipUpdateZoomTrackBar = true;
         PicturePreview.SetZoomAnimated(((ZoomTrackBarControl)sender).Value / 100.0);
     }
     finally {
         SkipUpdateZoomTrackBar = false;
     }
 }
Beispiel #3
0
 /// <summary>
 /// 显示参考图
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ButtonCkt_Click(object sender, EventArgs e)
 {
     try
     {
         string         filePath = Path.Combine(@System.AppDomain.CurrentDomain.BaseDirectory, "Images\\CKT.png");
         PicturePreview formT    = new PicturePreview(filePath);
         DialogUtil.ShowDialog(formT, this, formT.Width + 300, formT.Height + 300, new Common.prop.FormWindowProp(false, false, FormBorderStyle.FixedDialog));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 internal void DeactivateCropTool()
 {
     PicturePreview.DeactivateCrop();
 }
 internal void ActivateCropTool()
 {
     PicturePreview.ActivateCrop();
 }
 private void bbUnzoom_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     PicturePreview.SetZoomAnimated(1.0);
 }
 private void bbFit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     PicturePreview.FitToScreen(true);
 }
Beispiel #8
0
        protected override void OnInit(EventArgs e)
        {
            if (File.Exists(HttpContext.Current.Server.MapPath("WebServiceFilters.asmx")))
            {
                ScriptManager?.Services.Add(
                    new ServiceReference
                {
                    Path = "/WebServiceFilters.asmx",
                });
            }

            Trace.WriteExt("BaseMainPage.BeginOnInit");
            if (PlaceHolderInUpInternal != null)
            {
                hiddenfieldForUrl    = new HiddenField();
                hiddenfieldForUrl.ID = "hfCUrl";
                PlaceHolderInUpInternal.Controls.Add(hiddenfieldForUrl);
                var value = Request.Params[hiddenfieldForUrl.UniqueID];
                if (!string.IsNullOrEmpty(value))
                {
                    MainPageUrlBuilder.Current = new MainPageUrlBuilder(value);
                }
            }

            var url = MainPageUrlBuilder.Current;

            if (url.IsDownload)
            {
                if (url.QueryParameters.ContainsKey("ManagerType"))
                {
                    var type        = BuildManager.GetType(url.QueryParameters["ManagerType"], false, true);
                    var fileManager = (IFileManager)Activator.CreateInstance(type);
                    if (fileManager.CheckPermit(Page))
                    {
                        fileManager.DownloadFile(Convert.ToInt64(url.QueryParameters["ID"]), url.QueryParameters["fieldName"], Response);
                        _control = Page.LoadControl("/UserControls/FileNotExists.ascx");
                    }
                    else
                    {
                        _control = Page.LoadControl("/UserControls/NoPermit.ascx");
                    }
                    PlaceHolder.Controls.Add(_control);
                }
            }

            if (url.IsExecute)
            {
                if (url.QueryParameters.ContainsKey("ManagerType"))
                {
                    var type           = BuildManager.GetType(url.QueryParameters["ManagerType"], false, true);
                    var executeManager = (IExecuteManager)Activator.CreateInstance(type);
                    if (executeManager.CheckPermit(Page))
                    {
                        executeManager.Execute(url.QueryParameters, Page);
                    }
                    else
                    {
                        _control = Page.LoadControl("/UserControls/NoPermit.ascx");
                    }
                    PlaceHolder.Controls.Add(_control);
                }
            }
            else if (!string.IsNullOrEmpty(url.UserControl))
            {
                if (!EmptyPage)
                {
                    _updateProgressBar = new UpdateProgressBar
                    {
                        ModalPopupBehaviorID = "UpdateProgressBar"
                    };
                    _picturePreview = (PicturePreview)LoadControl("/Preview/PicturePreview.ascx");
                    Form.Controls.Add(_updateProgressBar);
                    Form.Controls.Add(_picturePreview);
                }

                string redirectUrl = GetRedirectUrl(url.UserControl);
                if (!string.IsNullOrEmpty(redirectUrl))
                {
                    Response.Redirect(redirectUrl);
                }
                _control = BaseMainPage.LoadControl(Page, url.UserControl);
                //проверка прав, если нет прав, то загрузить контрол "Нет прав"
                var access = _control as IAccessControl;
                Trace.WriteExt("BaseMainPage.OnInit.BeginCheckPermit");
                if ((access != null && !access.CheckPermit(this)))
                {
                    _control = Page.LoadControl("/UserControls/NoPermit.ascx");
                }
                Trace.WriteExt("BaseMainPage.OnInit.EndCheckPermit");
                if (!UserRoles.IsInRole(UserRoles.ADMIN))
                {
                    Trace.WriteExt("BaseMainPage.OnInit.BeginEnsureRecordCardCorrect");
                    var userControl = EnsureRecordCardCorrect();
                    Trace.WriteExt("BaseMainPage.OnInit.EndEnsureRecordCardCorrect");
                    if (userControl != null)
                    {
                        _control = userControl;
                    }
                }

                if (url.NavigateTo)
                {
                    var navControl  = (AbstractUserControl)_control;
                    var projectName = navControl.ProjectName;
                    var tableName   = navControl.TableName;
                    var baseType    = navControl.GetType().BaseType;

                    if (string.IsNullOrEmpty(projectName))
                    {
                        projectName = baseType.Assembly.FullName.Split(',')[0];
                    }

                    if (string.IsNullOrEmpty(tableName) && baseType.Name.EndsWith(MainPageUrlBuilder.UserControlTypeEdit))
                    {
                        tableName = baseType.Name;
                        tableName = tableName.Substring(0, tableName.Length - MainPageUrlBuilder.UserControlTypeEdit.Length);
                    }

                    var navigateUrl = NavigatorManager.GetReadUrlForRecord(
                        projectName,
                        tableName,
                        url.QueryParameters[MainPageUrlBuilder.ReferencIDPrefix + tableName],
                        url.QueryParameters.ContainsKey(MainPageUrlBuilder.NavigateToDestinationParentTableName)
                            ? url.QueryParameters[MainPageUrlBuilder.NavigateToDestinationParentTableName]
                            : string.Empty,
                        regexPublicKeyToken.Match(baseType.Assembly.FullName).Groups[1].Value);
                    Response.Redirect(navigateUrl);
                }

                var selected = _control as ISelectedValue;
                _control.ID = "item";
                var placeHolder = GetMainPlaceHolder();
                if (url.TimeoutInSQL)
                {
                    placeHolder.Controls.Add(new Literal
                    {
                        Text = "<span class=\"font14\" style=\"color:red\">"
                               + Resources.SFilterInSqlTimeOutException
                               + "</span>",
                    });
                }

                if (_control is IFilterSupport fSupport && InitializerSection.AddFilterInMainPageInternal && (url.IsSelect || url.ShowFilter))
                {
                    _filterControl    = LoadControlFilter(fSupport.GetDefaultFilterControl());
                    _filterControl.ID = "filter";
                    placeHolder.Controls.Add(_filterControl);
                    placeHolder.Controls.Add(new Literal {
                        Text = "<br /><br />"
                    });
                    fSupport.FilterControl = _filterControl.ID;
                }

                if (selected != null)
                {
                    selected.ShowHistory = url.ShowHistory;
                    selected.IsNew       = url.IsNew;
                    selected.IsRead      = url.IsRead;
                    selected.IsSelect    = url.IsSelect;
                }

                placeHolder.Controls.Add(_control);
            }
            else if (!string.IsNullOrEmpty(DefaultControl))
            {
                _control = Page.LoadControl(DefaultControl);
                if (_control != null)
                {
                    PlaceHolder.Controls.Add(_control);
                }
            }
            Trace.WriteExt("BaseMainPage.EndOnInit");
            base.OnInit(e);
            PreRenderComplete += Page_PreRenderComplete;
        }