Exemplo n.º 1
0
 private void btnFileDownload_ButtonClick(object sender,
                                          DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (DocumentGrid.GetFocusedRow() is Documents documents)
     {
         SaveFileDialog dialog = new SaveFileDialog()
         {
             OverwritePrompt = true,
             AddExtension    = true,
             DefaultExt      = documents.ExtName.Replace(".", "")
         };
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             using (NetworkShareAccesser.Access("PLGUNV_ADSERVER", @"PLGUNV", "administrator", "itpower@123"))
             {
                 try
                 {
                     File.Copy(Path.Combine(documents.RootDirectory, documents.FileId + documents.ExtName),
                               dialog.FileName);
                 }
                 catch (Exception exception)
                 {
                     MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK,
                                     MessageBoxIcon.Exclamation);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 private void btnFileView_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (DocumentGrid.GetFocusedRow() is Documents documents)
     {
         using (NetworkShareAccesser.Access("PLGUNV_ADSERVER", @"PLGUNV", "administrator", "itpower@123"))
         {
             try
             {
                 XtraForm xtraForm = new XtraForm()
                 {
                     StartPosition = FormStartPosition.CenterScreen
                 };
                 var pct = new PictureEdit()
                 {
                     Dock  = DockStyle.Fill,
                     Image = Image.FromFile(Path.Combine(documents.RootDirectory,
                                                         documents.FileId + documents.ExtName)),
                 };
                 pct.Properties.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Squeeze;
                 xtraForm.Controls.Add(pct);
                 xtraForm.ShowDialog();
             }
             catch (Exception exception)
             {
                 MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK,
                                 MessageBoxIcon.Exclamation);
             }
         }
     }
 }
Exemplo n.º 3
0
            internal void AddMenuItems(DocumentGrid dg, bool userInitiated)
            {
                // create a special menu item for paste which only works for user initiated copy
                // within the confines of partial trust this cannot be done programmatically
                if (userInitiated == false)
                {
                    SecurityHelper.DemandAllClipboardPermission();
                }

                this.Name = "ViewerContextMenu";

                SetMenuProperties(new EditorMenuItem(), dg, ApplicationCommands.Copy); // Copy will be marked as user initiated

                // build menu for XPSViewer
                SetMenuProperties(new MenuItem(), dg, ApplicationCommands.SelectAll);

                AddSeparator();

                SetMenuProperties(
                    new MenuItem(),
                    dg,
                    NavigationCommands.PreviousPage,
                    SR.Get(SRID.DocumentApplicationContextMenuPreviousPageHeader),
                    SR.Get(SRID.DocumentApplicationContextMenuPreviousPageInputGesture));

                SetMenuProperties(
                    new MenuItem(),
                    dg,
                    NavigationCommands.NextPage,
                    SR.Get(SRID.DocumentApplicationContextMenuNextPageHeader),
                    SR.Get(SRID.DocumentApplicationContextMenuNextPageInputGesture));

                SetMenuProperties(
                    new MenuItem(),
                    dg,
                    NavigationCommands.FirstPage,
                    null, //menu header
                    SR.Get(SRID.DocumentApplicationContextMenuFirstPageInputGesture));

                SetMenuProperties(
                    new MenuItem(),
                    dg,
                    NavigationCommands.LastPage,
                    null, //menu header
                    SR.Get(SRID.DocumentApplicationContextMenuLastPageInputGesture));

                AddSeparator();

                SetMenuProperties(new MenuItem(), dg, ApplicationCommands.Print);
            }
 internal void AddMenuItems(DocumentGrid dg, bool userInitiated)
 {
     if (!userInitiated)
     {
         SecurityHelper.DemandAllClipboardPermission();
     }
     base.Name = "ViewerContextMenu";
     this.SetMenuProperties(new DocumentGridContextMenu.EditorMenuItem(), dg, ApplicationCommands.Copy);
     this.SetMenuProperties(new MenuItem(), dg, ApplicationCommands.SelectAll);
     this.AddSeparator();
     this.SetMenuProperties(new MenuItem(), dg, NavigationCommands.PreviousPage, SR.Get("DocumentApplicationContextMenuPreviousPageHeader"), SR.Get("DocumentApplicationContextMenuPreviousPageInputGesture"));
     this.SetMenuProperties(new MenuItem(), dg, NavigationCommands.NextPage, SR.Get("DocumentApplicationContextMenuNextPageHeader"), SR.Get("DocumentApplicationContextMenuNextPageInputGesture"));
     this.SetMenuProperties(new MenuItem(), dg, NavigationCommands.FirstPage, null, SR.Get("DocumentApplicationContextMenuFirstPageInputGesture"));
     this.SetMenuProperties(new MenuItem(), dg, NavigationCommands.LastPage, null, SR.Get("DocumentApplicationContextMenuLastPageInputGesture"));
     this.AddSeparator();
     this.SetMenuProperties(new MenuItem(), dg, ApplicationCommands.Print);
 }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "HWA", "BCloadIframe();", true);
            }
            if (ViewState["ListInViewState"] != null)
            {
                DocumentsList = (List <Documents>)ViewState["ListInViewState"];
            }
            string stringIdea = Request.QueryString["Idea"].ToString();

            notlang = Request.QueryString["notlang"];
            if (notlang == "English")
            {
                showspanish = true;
            }
            else
            {
                showspanish = false;
            }
            if (showspanish)
            {
                switchtospanish();
            }
            if (!showspanish)
            {
                switchtoenglish();
            }

            int.TryParse(stringIdea, out checkIdeaD);
            DocumentsList.Clear();
            loadDocuments();
            if (DocumentsList.Count() < 1)
            {
                NoDocs.Visible = true;
            }
            else
            {
                DocumentGrid.DataSource = DocumentsList;
                DocumentGrid.DataBind();
                NoDocs.Visible  = false;
                gridDiv.Visible = true;
            }
        }
        private static void OnContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            DocumentGrid documentGrid = sender as DocumentGrid;

            if (documentGrid == null)
            {
                return;
            }
            if (!(documentGrid.DocumentViewerOwner is DocumentApplicationDocumentViewer))
            {
                return;
            }
            if (documentGrid.DocumentViewerOwner.ContextMenu != null || documentGrid.DocumentViewerOwner.ScrollViewer.ContextMenu != null)
            {
                return;
            }
            ContextMenu contextMenu = documentGrid.ContextMenu;

            if (documentGrid.ReadLocalValue(FrameworkElement.ContextMenuProperty) == null)
            {
                return;
            }
            if (contextMenu != null)
            {
                return;
            }
            contextMenu                 = new DocumentGridContextMenu.ViewerContextMenu();
            contextMenu.Placement       = PlacementMode.RelativePoint;
            contextMenu.PlacementTarget = documentGrid;
            ((DocumentGridContextMenu.ViewerContextMenu)contextMenu).AddMenuItems(documentGrid, e.UserInitiated);
            Point position;

            if (e.CursorLeft == -1.0)
            {
                position = new Point(0.5 * documentGrid.ViewportWidth, 0.5 * documentGrid.ViewportHeight);
            }
            else
            {
                position = Mouse.GetPosition(documentGrid);
            }
            contextMenu.HorizontalOffset = position.X;
            contextMenu.VerticalOffset   = position.Y;
            contextMenu.IsOpen           = true;
            e.Handled = true;
        }
 // Token: 0x06008D63 RID: 36195 RVA: 0x00259504 File Offset: 0x00257704
 private void SetMenuProperties(MenuItem menuItem, DocumentGrid dg, RoutedUICommand command, string header, string inputGestureText)
 {
     menuItem.Command       = command;
     menuItem.CommandTarget = dg.DocumentViewerOwner;
     if (header == null)
     {
         menuItem.Header = command.Text;
     }
     else
     {
         menuItem.Header = header;
     }
     if (inputGestureText != null)
     {
         menuItem.InputGestureText = inputGestureText;
     }
     menuItem.Name = "ViewerContextMenu_" + command.Name;
     base.Items.Add(menuItem);
 }
Exemplo n.º 8
0
            // Initialize the context menu.
            // Creates a new instance.
            internal void AddMenuItems(DocumentGrid dg, bool userInitiated)
            {
                this.Name = "ViewerContextMenu";

                SetMenuProperties(new EditorMenuItem(), dg, ApplicationCommands.Copy); // Copy will be marked as user initiated

                // build menu for XPSViewer
                SetMenuProperties(new MenuItem(), dg, ApplicationCommands.SelectAll);

                AddSeparator();

                SetMenuProperties(
                    new MenuItem(),
                    dg,
                    NavigationCommands.PreviousPage,
                    SR.Get(SRID.DocumentApplicationContextMenuPreviousPageHeader),
                    SR.Get(SRID.DocumentApplicationContextMenuPreviousPageInputGesture));

                SetMenuProperties(
                    new MenuItem(),
                    dg,
                    NavigationCommands.NextPage,
                    SR.Get(SRID.DocumentApplicationContextMenuNextPageHeader),
                    SR.Get(SRID.DocumentApplicationContextMenuNextPageInputGesture));

                SetMenuProperties(
                    new MenuItem(),
                    dg,
                    NavigationCommands.FirstPage,
                    null, //menu header
                    SR.Get(SRID.DocumentApplicationContextMenuFirstPageInputGesture));

                SetMenuProperties(
                    new MenuItem(),
                    dg,
                    NavigationCommands.LastPage,
                    null, //menu header
                    SR.Get(SRID.DocumentApplicationContextMenuLastPageInputGesture));

                AddSeparator();

                SetMenuProperties(new MenuItem(), dg, ApplicationCommands.Print);
            }
Exemplo n.º 9
0
        private FixedDocumentPage GetFixedPanelDocumentPage(Point pt)
        {
            DocumentGrid mpScope = _scope as DocumentGrid;

            if (mpScope != null)
            {
                DocumentPage      dp  = mpScope.GetDocumentPageFromPoint(pt);
                FixedDocumentPage fdp = dp as FixedDocumentPage;
                if (fdp == null)
                {
                    FixedDocumentSequenceDocumentPage fdsdp = dp as FixedDocumentSequenceDocumentPage;
                    if (fdsdp != null)
                    {
                        fdp = fdsdp.ChildDocumentPage as FixedDocumentPage;
                    }
                }
                return(fdp);
            }
            return(null);
        }
Exemplo n.º 10
0
        // Token: 0x06003516 RID: 13590 RVA: 0x000F0AD0 File Offset: 0x000EECD0
        private FixedDocumentPage GetFixedPanelDocumentPage(Point pt)
        {
            DocumentGrid documentGrid = this._scope as DocumentGrid;

            if (documentGrid != null)
            {
                DocumentPage      documentPageFromPoint = documentGrid.GetDocumentPageFromPoint(pt);
                FixedDocumentPage fixedDocumentPage     = documentPageFromPoint as FixedDocumentPage;
                if (fixedDocumentPage == null)
                {
                    FixedDocumentSequenceDocumentPage fixedDocumentSequenceDocumentPage = documentPageFromPoint as FixedDocumentSequenceDocumentPage;
                    if (fixedDocumentSequenceDocumentPage != null)
                    {
                        fixedDocumentPage = (fixedDocumentSequenceDocumentPage.ChildDocumentPage as FixedDocumentPage);
                    }
                }
                return(fixedDocumentPage);
            }
            return(null);
        }
Exemplo n.º 11
0
            private void SetMenuProperties(MenuItem menuItem, DocumentGrid dg, RoutedUICommand command, string header, string inputGestureText)
            {
                menuItem.Command       = command;
                menuItem.CommandTarget = dg.DocumentViewerOwner; // the text editor expects the commands to come from the DocumentViewer
                if (header == null)
                {
                    menuItem.Header = command.Text; // use default menu text for this command
                }
                else
                {
                    menuItem.Header = header;
                }

                if (inputGestureText != null)
                {
                    menuItem.InputGestureText = inputGestureText;
                }

                menuItem.Name = "ViewerContextMenu_" + command.Name; // does not require localization
                this.Items.Add(menuItem);
            }
 // Token: 0x06008D62 RID: 36194 RVA: 0x002594F5 File Offset: 0x002576F5
 private void SetMenuProperties(MenuItem menuItem, DocumentGrid dg, RoutedUICommand command)
 {
     this.SetMenuProperties(menuItem, dg, command, null, null);
 }
Exemplo n.º 13
0
        private static void OnContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            DocumentGrid documentGrid = sender as DocumentGrid;
            ContextMenu  contextMenu;

            if (documentGrid == null)
            {
                return;
            }

            // We only want to programmatically generate the menu for Mongoose
            if (!(documentGrid.DocumentViewerOwner is DocumentApplicationDocumentViewer))
            {
                return;
            }

            // If the DocumentViewer or ScrollViewer has a ContextMenu set, the DocumentGrid menu should be ignored
            if (documentGrid.DocumentViewerOwner.ContextMenu != null || documentGrid.DocumentViewerOwner.ScrollViewer.ContextMenu != null)
            {
                return;
            }

            // Start by grabbing whatever's set to the UiScope's ContextMenu property.
            contextMenu = documentGrid.ContextMenu;

            // If someone explicitly set it null -- don't mess with it.
            if (documentGrid.ReadLocalValue(FrameworkElement.ContextMenuProperty) == null)
            {
                return;
            }

            // If it's not null, someone's overriding our default -- don't mess with it.
            if (contextMenu != null)
            {
                return;
            }

            // It's a default null, so spin up a temporary ContextMenu now.
            contextMenu                 = new ViewerContextMenu();
            contextMenu.Placement       = PlacementMode.RelativePoint;
            contextMenu.PlacementTarget = documentGrid;
            ((ViewerContextMenu)contextMenu).AddMenuItems(documentGrid, e.UserInitiated);

            Point uiScopeMouseDownPoint;

            if (e.CursorLeft == KeyboardInvokedSentinel)
            {
                uiScopeMouseDownPoint = new Point(.5 * documentGrid.ViewportWidth, .5 * documentGrid.ViewportHeight);
            }
            else
            {
                uiScopeMouseDownPoint = Mouse.GetPosition(documentGrid);
            }

            contextMenu.HorizontalOffset = uiScopeMouseDownPoint.X;
            contextMenu.VerticalOffset   = uiScopeMouseDownPoint.Y;

            // This line raises a public event.
            contextMenu.IsOpen = true;

            e.Handled = true;
        }