Ejemplo n.º 1
0
    protected void CheckPermissions(UserGroup ug, RadToolBar rdt)
    {
        foreach (RadToolBarItem i in rdt.Items)
        {
            Process pr = (from p in ctx.Processes
                          where p.Code == i.Value
                          select p).FirstOrDefault <Process>();

            if (pr != null)
            {
                Permission per = CntAriCli.GetPermission(ug, pr, ctx);
                if (per != null)
                {
                    if (!per.View)
                    {
                        i.Visible = false;
                    }
                }
                else
                {
                    i.Visible = false;  // If no permission not show
                }
            }
            else
            {
                i.Visible = false;  // If doesn't exits not show
            }
        }
    }
Ejemplo n.º 2
0
        public void ValidarPermisos(RadToolBar rtb1)
        {
            try
            {
                Sesion Sesion = new Sesion();
                Sesion = (Sesion)Session["Sesion" + Session.SessionID];

                Pagina   pagina = new Pagina();
                string[] pag    = pagOri.Request.Url.ToString().Split(new string[] { "?" }, StringSplitOptions.RemoveEmptyEntries);
                if (pag.Length > 1)
                {
                    pagina.Url = (new System.IO.FileInfo(pagOri.Request.Url.AbsolutePath)).Name + "?" + pag[1];
                }
                else
                {
                    pagina.Url = (new System.IO.FileInfo(pagOri.Request.Url.AbsolutePath)).Name;
                }
                CN_Pagina CapaNegocio = new CN_Pagina();
                CapaNegocio.PaginaConsultar(ref pagina, Sesion.Emp_Cnx);

                Session["Head" + Session.SessionID] = pagina.Path;
                this.Title = pagina.Descripcion;
                Permiso Permiso = new Permiso();
                Permiso.Id_U   = Sesion.Id_U;
                Permiso.Id_Cd  = Sesion.Id_Cd;
                Permiso.Sm_cve = pagina.Clave;
                //Esta clave depende de la pantalla

                CapaDatos.CD_PermisosU CN_PermisosU = new CapaDatos.CD_PermisosU();
                CN_PermisosU.ValidaPermisosUsuario(ref Permiso, Sesion.Emp_Cnx);

                if (Permiso.PAccesar == true)
                {
                    _PermisoGuardar   = Permiso.PGrabar;
                    _PermisoModificar = Permiso.PModificar;
                    _PermisoEliminar  = Permiso.PEliminar;
                    _PermisoImprimir  = Permiso.PImprimir;

                    rtb1.Items[6].Visible = false;
                    //Guardar
                    rtb1.Items[5].Visible = false;
                    //Regresar
                    rtb1.Items[4].Visible = false;
                    //Eliminar
                    rtb1.Items[3].Visible = false;
                    //Imprimir
                    rtb1.Items[2].Visible = false;
                    //Correo
                    rtb1.Items[1].Visible = false;
                }
                else
                {
                    pagOri.Response.Redirect("Inicio.aspx");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
            private static int CalculateBandIndex(Orientation orientation, RadToolBar sourceToolBar, List <RadToolBar> toolBars, Point mousePosition)
            {
                double position = orientation == Orientation.Horizontal ? mousePosition.X : mousePosition.Y;
                Func <RadToolBar, double> length = tb => orientation == Orientation.Horizontal ? (tb.ActualWidth + tb.Margin.Left + tb.Margin.Right) : (tb.ActualHeight + tb.Margin.Top + tb.Margin.Bottom);

                double currentPosition = 0;
                int    index           = 0;

                foreach (RadToolBar toolBar in toolBars)
                {
                    if (toolBar != sourceToolBar)
                    {
                        double toolBarLength = length(toolBar);
                        if (position <= currentPosition + toolBarLength)
                        {
                            bool positionDraggedBarAfterCurrentBar = (currentPosition + toolBarLength - position) < (position - currentPosition);
                            if (positionDraggedBarAfterCurrentBar)
                            {
                                index++;
                            }
                            break;
                        }

                        currentPosition += toolBarLength;
                        index++;
                    }
                }

                return(index);
            }
        private static void ToolBarDragDropCompleted(object sender, DragDropCompletedEventArgs e)
        {
            RadToolBar   toolBar = e.Source as RadToolBar;
            DragDropInfo info    = GetDragDropInfo(e.Data);

            if (toolBar == null || info == null)
            {
                return;
            }

            DragDropManager.RemoveDragDropCompletedHandler(info.ToolBar, ToolBarDragDropCompleted);
            DragDropManager.RemoveGiveFeedbackHandler(info.ToolBar, ToolBarGiveFeedback);

            ClearActiveToolBarStyle(info.ToolBar);
            ClearHitTesting(info.Tray.Items);
            CloseHost(info);
            if (info.DragVisual.Child != null)
            {
                info.DragVisual.Child = null;

                Window dragVisualWindow = Window.GetWindow(info.DragVisual);

                InitializeHost(info.ToolBar, dragVisualWindow.Left, dragVisualWindow.Top);
            }

            HideNewBandIndicator(info.Tray);

            e.Handled = true;
        }
Ejemplo n.º 5
0
 internal static void UpdateToolBarPosition(RadToolBarTray tray, RadToolBar toolBar, ToolBarPositionInfo positionInfo, bool allowNewBandCreation)
 {
     toolBar.Band = (allowNewBandCreation && positionInfo.NewBand.HasValue) ? positionInfo.NewBand.Value : (positionInfo.Band.HasValue ? positionInfo.Band.Value : 0);
     toolBar.BandIndex = positionInfo.BandIndex;
     for (int i = 0; i < positionInfo.BandIndex; i++)
     {
         positionInfo.ToolBars[i].BandIndex = i < positionInfo.BandIndex ? i : i + 1;
     }
 }
Ejemplo n.º 6
0
 internal static void UpdateToolBarPosition(RadToolBarTray tray, RadToolBar toolBar, ToolBarPositionInfo positionInfo, bool allowNewBandCreation)
 {
     toolBar.Band      = (allowNewBandCreation && positionInfo.NewBand.HasValue) ? positionInfo.NewBand.Value : (positionInfo.Band.HasValue ? positionInfo.Band.Value : 0);
     toolBar.BandIndex = positionInfo.BandIndex;
     for (int i = 0; i < positionInfo.BandIndex; i++)
     {
         positionInfo.ToolBars[i].BandIndex = i < positionInfo.BandIndex ? i : i + 1;
     }
 }
        private static Image CreateDragImageFromToolBar(RadToolBar bar)
        {
            Image draggingImage = new System.Windows.Controls.Image
            {
                Source = new Telerik.Windows.Media.Imaging.RadBitmap(bar).Bitmap,
                Width  = bar.ActualWidth,
                Height = bar.ActualHeight
            };

            return(draggingImage);
        }
    protected void borrarCondiciones()
    {
        if (FileExplorerObrasParticulares.Visible == true)
        {
            RadToolBar toolBar = FileExplorerObrasParticulares.ToolBar;
            int        i       = 0;
            while (i < toolBar.Items.Count)
            {
                if (toolBar.Items[i].Value == "Delete")
                {
                    toolBar.Items.RemoveAt(i);
                    continue;
                }

                else if (toolBar.Items[i].Value == "Upload")
                {
                    toolBar.Items.RemoveAt(i);
                    continue;
                }
                else if (toolBar.Items[i].Value == "Rename")
                {
                    toolBar.Items.RemoveAt(i);
                    continue;
                }

                i++;
            }
            RadContextMenu gridContextMenu = FileExplorerObrasParticulares.GridContextMenu;
            i = 0;
            while (i < gridContextMenu.Items.Count)
            {
                if (gridContextMenu.Items[i].Value == "Delete")
                {
                    gridContextMenu.Items.RemoveAt(i);
                    continue;
                }

                else if (gridContextMenu.Items[i].Value == "Upload")
                {
                    gridContextMenu.Items.RemoveAt(i);
                    continue;
                }
                else if (gridContextMenu.Items[i].Value == "Rename")
                {
                    gridContextMenu.Items.RemoveAt(i);
                    continue;
                }
                i++;
            }
        }
    }
Ejemplo n.º 9
0
    protected void borrarCondiciones()
    {
        if (Session["Permiso"].ToString() == "profesional")
        {
            Response.Redirect("http://planodigital.tigre.gov.ar/index.html");
        }

        if (FileExplorerObrasParticulares.Visible == true)
        {
            RadToolBar toolBar = FileExplorerObrasParticulares.ToolBar;
            int        i       = 0;
            while (i < toolBar.Items.Count)
            {
                if (toolBar.Items[i].Value == "Upload")
                {
                    toolBar.Items.RemoveAt(i);
                    continue;
                }
                else if (toolBar.Items[i].Value == "Rename")
                {
                    toolBar.Items.RemoveAt(i);
                    continue;
                }
                i++;
            }
            RadContextMenu gridContextMenu = FileExplorerObrasParticulares.GridContextMenu;
            i = 0;
            while (i < gridContextMenu.Items.Count)
            {
                if (gridContextMenu.Items[i].Value == "Upload")
                {
                    gridContextMenu.Items.RemoveAt(i);
                    continue;
                }
                else if (gridContextMenu.Items[i].Value == "Rename")
                {
                    gridContextMenu.Items.RemoveAt(i);
                    continue;
                }
                i++;
            }
            RadMenuItem item = new RadMenuItem("Descargar");
            item.PostBack = false;
            item.Value    = "Descargar";
            gridContextMenu.Items.Add(item);
        }
    }
Ejemplo n.º 10
0
            internal static ToolBarPositionInfo CalculateToolBarPositionInfo(RadToolBar sourceToolBar, RadToolBarTray tray, Point mousePosition)
            {
                var band = CalculateBand(sourceToolBar, tray, mousePosition);

                List<RadToolBar> toolBars = new List<RadToolBar>();
                foreach (RadToolBar toolBar in tray.Items)
                {
                    if (toolBar != sourceToolBar && toolBar.Band == band.Band)
                    {
                        toolBars.Add(toolBar);
                    }
                }
                toolBars = toolBars.OrderBy(tb => tb.BandIndex).ToList();

                int bandIndex = CalculateBandIndex(tray.Orientation, sourceToolBar, toolBars, mousePosition);

                return new ToolBarPositionInfo(band.Band, band.NewBand, bandIndex, toolBars);
            }
        private static void ToolBarDragDropCompleted(object sender, DragDropCompletedEventArgs e)
        {
            RadToolBar   toolBar = e.Source as RadToolBar;
            DragDropInfo info    = GetDragDropInfo(e.Data);

            if (toolBar == null || info == null)
            {
                return;
            }

            DragDropManager.RemoveDragDropCompletedHandler(info.ToolBar, ToolBarDragDropCompleted);

            ClearActiveToolBarStyle(info.ToolBar);
            ClearHitTesting(info.Tray.Items);

            HideNewBandIndicator(info.Tray);

            e.Handled = true;
        }
Ejemplo n.º 12
0
            internal static ToolBarPositionInfo CalculateToolBarPositionInfo(RadToolBar sourceToolBar, RadToolBarTray tray, Point mousePosition)
            {
                var band = CalculateBand(sourceToolBar, tray, mousePosition);

                List <RadToolBar> toolBars = new List <RadToolBar>();

                foreach (RadToolBar toolBar in tray.Items)
                {
                    if (toolBar != sourceToolBar && toolBar.Band == band.Band)
                    {
                        toolBars.Add(toolBar);
                    }
                }
                toolBars = toolBars.OrderBy(tb => tb.BandIndex).ToList();

                int bandIndex = CalculateBandIndex(tray.Orientation, sourceToolBar, toolBars, mousePosition);

                return(new ToolBarPositionInfo(band.Band, band.NewBand, bandIndex, toolBars));
            }
Ejemplo n.º 13
0
 protected void borrarCondiciones()
 {
     cargarTotal();
     if (FileExplorerObrasParticulares.Visible == true)
     {
         RadToolBar toolBar = FileExplorerObrasParticulares.ToolBar;
         int        i       = 0;
         while (i < toolBar.Items.Count)
         {
             if (toolBar.Items[i].Value == "Upload")
             {
                 toolBar.Items.RemoveAt(i);
                 continue;
             }
             else if (toolBar.Items[i].Value == "Rename")
             {
                 toolBar.Items.RemoveAt(i);
                 continue;
             }
             i++;
         }
         RadContextMenu gridContextMenu = FileExplorerObrasParticulares.GridContextMenu;
         i = 0;
         while (i < gridContextMenu.Items.Count)
         {
             if (gridContextMenu.Items[i].Value == "Upload")
             {
                 gridContextMenu.Items.RemoveAt(i);
                 continue;
             }
             else if (gridContextMenu.Items[i].Value == "Rename")
             {
                 gridContextMenu.Items.RemoveAt(i);
                 continue;
             }
             i++;
         }
         RadMenuItem item = new RadMenuItem("Descargar");
         item.PostBack = false;
         item.Value    = "Descargar";
         gridContextMenu.Items.Add(item);
     }
 }
Ejemplo n.º 14
0
 protected void RadGrid1_PreRender(object sender, EventArgs e)
 {
     if (this.rcbSupplier.SelectedValue == "")
     {
         foreach (GridCommandItem cmdItem in RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem))
         {
             RadToolBar rdtlbr = (RadToolBar)cmdItem.FindControl("RadToolBar2");
             rdtlbr.FindItemByValue("Delete").Enabled   = false;
             rdtlbr.FindItemByValue("Transfer").Enabled = true;
         }
     }
     else
     {
         foreach (GridCommandItem cmdItem in RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem))
         {
             RadToolBar rdtlbr = (RadToolBar)cmdItem.FindControl("RadToolBar2");
             rdtlbr.FindItemByValue("Transfer").Enabled = false;
         }
     }
 }
        private static void InitializeHost(RadToolBar toolBar, double left, double top)
        {
            Border border = new Border();

            border.Background = new SolidColorBrush(new Color {
                A = 50, R = 127, G = 127, B = 127
            });
            border.CornerRadius = new CornerRadius(3);
            RadToolBarTray tray = new RadToolBarTray();

            tray.Orientation = toolBar.Orientation;
            tray.Items.Add(toolBar);
            border.Child = tray;
            double hMargin = DragDropManager.MinimumHorizontalDragDistance;
            double vMargin = DragDropManager.MinimumVerticalDragDistance;

            tray.Margin = new Thickness(hMargin, vMargin, hMargin, vMargin);
            DragDropManager.AddDragInitializeHandler(tray, TrayDragInitialized);
            FrameworkElement host = InitializeWindowHost(border, left - hMargin - 1, top - vMargin);

            trayToHostDict[tray] = host;
        }
        private static void TrayDragInitialized(object sender, DragInitializeEventArgs e)
        {
            RadToolBarTray tray    = sender as RadToolBarTray;
            RadToolBar     toolBar = e.Source as RadToolBar;

            if (tray == null || toolBar == null)
            {
                return;
            }

            DragDropInfo info = new DragDropInfo(toolBar, tray);

            lastInitializedInfo = info;
            if (trayToHostDict.ContainsKey(tray) || !tray.IsMouseOver)
            {
                MoveToolBarToDragVisual(info, tray);
            }
            else
            {
                SetHitTesting(info.Tray.Items);
            }

            SetActiveToolBarStyle(info.ToolBar);
            if (trayToHostDict.ContainsKey(info.Tray))
            {
                trayToHostDict[info.Tray].Opacity = 0;
            }

            DragDropManager.AddDragDropCompletedHandler(info.ToolBar, ToolBarDragDropCompleted);
            DragDropManager.AddGiveFeedbackHandler(info.ToolBar, ToolBarGiveFeedback);

            e.Data             = info;
            e.DragVisual       = info.DragVisual;
            e.DragVisualOffset = e.RelativeStartPoint;
            e.AllowedEffects   = DragDropEffects.All;
            e.Handled          = true;
        }
        private static void TrayDragInitialized(object sender, DragInitializeEventArgs e)
        {
            RadToolBarTray tray    = sender as RadToolBarTray;
            RadToolBar     toolBar = e.Source as RadToolBar;

            if (tray == null || toolBar == null)
            {
                return;
            }

            DragDropInfo info = new DragDropInfo(toolBar, tray);

            lastInitializedInfo = info;

            SetActiveToolBarStyle(info.ToolBar);

            DragDropManager.AddDragDropCompletedHandler(info.ToolBar, ToolBarDragDropCompleted);

            e.DragVisual       = CreateDragImageFromToolBar(info.ToolBar);
            e.Data             = info;
            e.DragVisualOffset = e.RelativeStartPoint;
            e.AllowedEffects   = DragDropEffects.All;
            e.Handled          = true;
        }
Ejemplo n.º 18
0
 private static void SetActiveToolBarStyle(RadToolBar toolBar)
 {
     toolBar.Background = new SolidColorBrush(new Color { A = 127, R = 127, G = 127, B = 127, });
 }
Ejemplo n.º 19
0
 internal DragDropInfo(RadToolBar toolBar, RadToolBarTray tray)
 {
     this.ToolBar    = toolBar;
     this.Tray       = tray;
     this.DragVisual = new Border();
 }
Ejemplo n.º 20
0
            private static BandInfo CalculateBand(RadToolBar toolBar, RadToolBarTray tray, Point mousePosition)
            {
                double position = tray.Orientation == Orientation.Horizontal ? mousePosition.Y : mousePosition.X;
                double newBandVicinity = 6;

                int? newBand = null;
                if (position < newBandVicinity)
                {
                    // Create new band, to left or to top.
                    newBand = -1;
                }

                var bands = GetBandsDict(tray);
                double trayLength = tray.Orientation == Orientation.Horizontal ? tray.ActualHeight : tray.ActualWidth;

                if (trayLength - newBandVicinity < position)
                {
                    // Create new band, to right or to bottom.
                    newBand = bands.Keys.Count;
                }

                Func<RadToolBar, double> length = tb => tray.Orientation == Orientation.Horizontal ?
                    (tb.ActualHeight + tb.Margin.Top + tb.Margin.Bottom) :
                    (tb.ActualWidth + tb.Margin.Left + tb.Margin.Right);
                List<int> keys = bands.Keys.ToList();
                int? existingBand = null;
                double currentPosition = 0;

                for (int i = 0; i < keys.Count; i++)
                {
                    existingBand = keys[i];
                    double bandLength = length(bands[keys[i]][0]);
                    if (position <= currentPosition + bandLength)
                    {
                        if (keys[i] == 1 &&
                            bands[keys[0]].Count == 1 &&
                            bands[keys[0]][0] == toolBar &&
                            position < currentPosition + (1 * newBandVicinity))
                        {
                            // Avoid flicker when the dragged toolbar is the only element in the first band.
                            existingBand = 0;
                        }
                        else if (keys[i] == keys.Count - 2 &&
                            bands[keys[keys.Count - 1]].Count == 1 &&
                            bands[keys[keys.Count - 1]][0] == toolBar &&
                            currentPosition + bandLength - (1 * newBandVicinity) < position)
                        {
                            // Avoid flicker when the dragged toolbar is the only element in the last band.
                            existingBand = keys.Count - 1;
                        }

                        break;
                    }

                    currentPosition += bandLength;
                }

                if (newBand.HasValue && existingBand.HasValue && bands[existingBand.Value].Count == 1 && bands[existingBand.Value][0] == toolBar)
                {
                    // A new band will not be created because the dragged bar is the only element in the existing band.
                    newBand = null;
                }

                return new BandInfo { Band = existingBand, NewBand = newBand };
            }
Ejemplo n.º 21
0
            private static BandInfo CalculateBand(RadToolBar toolBar, RadToolBarTray tray, Point mousePosition)
            {
                double position        = tray.Orientation == Orientation.Horizontal ? mousePosition.Y : mousePosition.X;
                double newBandVicinity = 6;

                int?newBand = null;

                if (position < newBandVicinity)
                {
                    // Create new band, to left or to top.
                    newBand = -1;
                }

                var    bands      = GetBandsDict(tray);
                double trayLength = tray.Orientation == Orientation.Horizontal ? tray.ActualHeight : tray.ActualWidth;

                if (trayLength - newBandVicinity < position)
                {
                    // Create new band, to right or to bottom.
                    newBand = bands.Keys.Count;
                }

                Func <RadToolBar, double> length = tb => tray.Orientation == Orientation.Horizontal ?
                                                   (tb.ActualHeight + tb.Margin.Top + tb.Margin.Bottom) :
                                                   (tb.ActualWidth + tb.Margin.Left + tb.Margin.Right);
                List <int> keys            = bands.Keys.ToList();
                int?       existingBand    = null;
                double     currentPosition = 0;

                for (int i = 0; i < keys.Count; i++)
                {
                    existingBand = keys[i];
                    double bandLength = length(bands[keys[i]][0]);
                    if (position <= currentPosition + bandLength)
                    {
                        if (keys[i] == 1 &&
                            bands[keys[0]].Count == 1 &&
                            bands[keys[0]][0] == toolBar &&
                            position < currentPosition + (1 * newBandVicinity))
                        {
                            // Avoid flicker when the dragged toolbar is the only element in the first band.
                            existingBand = 0;
                        }
                        else if (keys[i] == keys.Count - 2 &&
                                 bands[keys[keys.Count - 1]].Count == 1 &&
                                 bands[keys[keys.Count - 1]][0] == toolBar &&
                                 currentPosition + bandLength - (1 * newBandVicinity) < position)
                        {
                            // Avoid flicker when the dragged toolbar is the only element in the last band.
                            existingBand = keys.Count - 1;
                        }

                        break;
                    }

                    currentPosition += bandLength;
                }

                if (newBand.HasValue && existingBand.HasValue && bands[existingBand.Value].Count == 1 && bands[existingBand.Value][0] == toolBar)
                {
                    // A new band will not be created because the dragged bar is the only element in the existing band.
                    newBand = null;
                }

                return(new BandInfo {
                    Band = existingBand, NewBand = newBand
                });
            }
 private static Image CreateDragImageFromToolBar(RadToolBar bar)
 {
     Image draggingImage = new System.Windows.Controls.Image
     {
         Source = new Telerik.Windows.Media.Imaging.RadBitmap(bar).Bitmap,
         Width = bar.ActualWidth,
         Height = bar.ActualHeight
     };
     return draggingImage;
 }
        protected void DownloadFileFromWeb(string filename, DownloadFileTypes fileType, RadToolBar rtb)
        {
            RadToolBarItem rtb_item01 = null;
            switch (fileType)
            {
                case DownloadFileTypes.CSV:
                    {
                        rtb_item01 = rtb.FindItemByText("CSV");
                        break;
                    }
                case DownloadFileTypes.INVPNG:
                    {
                        rtb_item01 = rtb.FindItemByText("Przezroczysty (PNG)");
                        break;
                    }
                case DownloadFileTypes.PNG:
                    {
                        rtb_item01 = rtb.FindItemByText("PNG");
                        break;
                    }
                case DownloadFileTypes.PPTX:
                    {
                        rtb_item01 = rtb.FindItemByText("Power Point (PPTX)");
                        break;
                    }
                case DownloadFileTypes.XLS:
                    {
                        rtb_item01 = rtb.FindItemByText("Excel (XLS)");
                        break;
                    }
                case DownloadFileTypes.XLSX:
                    {
                        rtb_item01 = rtb.FindItemByText("Aktualizowalny Excel (XLSX)");
                        break;
                    }

            }

            Assert.IsNotNull(rtb_item01, "Could not find option when trying to download the file");
            DownloadDialogsHandler handler = new DownloadDialogsHandler(ActiveBrowser, DialogButton.SAVE, dir + filename, Desktop);
            try
            {
                rtb_item01.Click();
            }
            catch { }
            ActiveBrowser.Window.SetFocus();

            handler.WaitUntilHandled(20000);

            Assert.IsFalse(ActiveBrowser.ContainsText("Application encountered an unexpected error. We are very sorry for any inconvenience."), "BinocleWeb Crashed !");
            System.Threading.Thread.Sleep(4000);
            DirectoryInfo directory = new DirectoryInfo(dir);
            Assert.IsTrue(directory.GetFiles(filename, SearchOption.AllDirectories).Length != 0);
            FileInfo file = directory.GetFiles(filename, SearchOption.TopDirectoryOnly)[0];
            file.Delete();
            Assert.IsTrue(directory.GetFiles(filename, SearchOption.AllDirectories).Length == 0);
        }
Ejemplo n.º 24
0
            private static int CalculateBandIndex(Orientation orientation, RadToolBar sourceToolBar, List<RadToolBar> toolBars, Point mousePosition)
            {
                double position = orientation == Orientation.Horizontal ? mousePosition.X : mousePosition.Y;
                Func<RadToolBar, double> length = tb => orientation == Orientation.Horizontal ? (tb.ActualWidth + tb.Margin.Left + tb.Margin.Right) : (tb.ActualHeight + tb.Margin.Top + tb.Margin.Bottom);

                double currentPosition = 0;
                int index = 0;
                foreach (RadToolBar toolBar in toolBars)
                {
                    if (toolBar != sourceToolBar)
                    {
                        double toolBarLength = length(toolBar);
                        if (position <= currentPosition + toolBarLength)
                        {
                            bool positionDraggedBarAfterCurrentBar = (currentPosition + toolBarLength - position) < (position - currentPosition);
                            if (positionDraggedBarAfterCurrentBar)
                            {
                                index++;
                            }
                            break;
                        }

                        currentPosition += toolBarLength;
                        index++;
                    }
                }

                return index;
            }
Ejemplo n.º 25
0
 internal DragDropInfo(RadToolBar toolBar, RadToolBarTray tray)
 {
     this.ToolBar = toolBar;
     this.Tray = tray;
     this.DragVisual = new Border();
 }
 private static void ClearActiveToolBarStyle(RadToolBar toolBar)
 {
     toolBar.ClearValue(RadToolBar.BackgroundProperty);
 }
 private static void SetActiveToolBarStyle(RadToolBar toolBar)
 {
     toolBar.Background = new SolidColorBrush(new Color {
         A = 127, R = 127, G = 127, B = 127,
     });
 }
Ejemplo n.º 28
0
 private static void ClearActiveToolBarStyle(RadToolBar toolBar)
 {
     toolBar.ClearValue(RadToolBar.BackgroundProperty);
 }
Ejemplo n.º 29
0
    protected void CheckPermissions(UserGroup ug, RadToolBar rdt)
    {
        foreach (RadToolBarItem i in rdt.Items)
        {
            Process pr = (from p in ctx.Processes
                          where p.Code == i.Value
                          select p).FirstOrDefault<Process>();

            if (pr != null)
            {
                Permission per = CntAriCli.GetPermission(ug, pr, ctx);
                if (per != null)
                {
                    if (!per.View) i.Visible = false;
                }
                else i.Visible = false; // If no permission not show
            }
            else i.Visible = false; // If doesn't exits not show
        }
    }
Ejemplo n.º 30
0
 private static void InitializeHost(RadToolBar toolBar, double left, double top)
 {
     Border border = new Border();
     border.Background = new SolidColorBrush(new Color { A = 50, R = 127, G = 127, B = 127 });
     border.CornerRadius = new CornerRadius(3);
     RadToolBarTray tray = new RadToolBarTray();
     tray.Orientation = toolBar.Orientation;
     tray.Items.Add(toolBar);
     border.Child = tray;
     double hMargin = DragDropManager.MinimumHorizontalDragDistance;
     double vMargin = DragDropManager.MinimumVerticalDragDistance;
     tray.Margin = new Thickness(hMargin, vMargin, hMargin, vMargin);
     DragDropManager.AddDragInitializeHandler(tray, TrayDragInitialized);
     FrameworkElement host = InitializeWindowHost(border, left - hMargin - 1, top - vMargin);
     trayToHostDict[tray] = host;
 }