Jun 24, 2015, 2:10 PM
Read WebForm Usercontrol in Desktop
Hello all
I inicianado a project using the Desktop component, made a UserControl, I wonder as I call it to the screen using the Desktop.
Below is the code I'm using.
Desktop.aspx
Click the menu looked like this:
TabWindows.ascx
I inicianado a project using the Desktop component, made a UserControl, I wonder as I call it to the screen using the Desktop.
Below is the code I'm using.
Desktop.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="Consorcio.Web.Sistema.Cadastros.WebForm3" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
var tile = function () {
Ext.net.Desktop.desktop.tileWindows();
};
var cascade = function () {
Ext.net.Desktop.desktop.cascadeWindows();
};
var initSlidePanel = function () {
this.setHeight(Ext.net.Desktop.desktop.body.getHeight());
if (!this.windowListen) {
this.windowListen = true;
this.show();
this.el.alignTo(Ext.net.Desktop.desktop.body, 'tl-tr', [0, 0]);
Ext.on("resize", initSlidePanel, this);
}
};
</script>
<style type="text/css">
.my-taskbar .ux-start-button .x-btn-inner {
background-image: url(../../resource/imagens/fundo/botaoi.fw.png) !important;
font-size: 13px;
font-weight: bold;
height: 30px;
width: 30px;
color: #003867;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" />
<ext:Hidden ID="hdUsuario" runat="server">
</ext:Hidden>
<ext:Hidden ID="hdEmpresa" runat="server">
</ext:Hidden>
<ext:Hidden ID="hdGrupo" runat="server">
</ext:Hidden>
<ext:Desktop ID="Desktop1" runat="server">
<DesktopConfig Wallpaper="../../resource/imagens/fundo/Fundo.png" ShortcutDragSelector="true" WallpaperStretch="true">
<ShortcutDefaults IconCls="x-default-shortcut" />
<ContextMenu>
<ext:Menu runat="server">
<Items>
<ext:MenuItem runat="server" Text="Mudar Configurações" />
<ext:MenuSeparator runat="server" />
<ext:MenuItem runat="server" Text="Lado a Lado" Handler="tile" Icon="ApplicationTileVertical" />
<ext:MenuItem runat="server" Text="Cascata" Handler="cascade" Icon="ApplicationCascade" />
</Items>
</ext:Menu>
</ContextMenu>
</DesktopConfig>
<StartMenu Title="Menu - Elohim Software" Icon="Add" Height="300" Width="400">
<MenuItems>
<ext:MenuItem runat="server" Text="Menu">
<Menu>
<ext:Menu ID="_root" runat="server">
<Items>
</Items>
</ext:Menu>
</Menu>
</ext:MenuItem>
</MenuItems>
<ToolConfig>
<ext:Toolbar runat="server" Width="150">
<Items>
<ext:Button runat="server" Text="Configuração" Icon="Cog" />
<ext:Button runat="server" Text="Sair do Sistema" Icon="Key">
<DirectEvents>
<Click OnEvent="LogOff_Click">
<EventMask ShowMask="true" Msg="Até Logo..." MinDelay="1000" />
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</ToolConfig>
</StartMenu>
<TaskBar TrayWidth="100" Cls="my-taskbar" StartBtnText=" " StartBtnIconCls=" ">
<QuickStart>
<ext:Toolbar runat="server">
<Items>
<ext:Button runat="server" Handler="tile" Icon="ApplicationTileVertical" OverflowText="Janelas Lado a Lado">
<QTipCfg Text="Ajusta as Janelas Lado a Lado" />
</ext:Button>
<ext:Button runat="server" Handler="cascade" Icon="ApplicationCascade" OverflowText="Janelas em Cascata">
<QTipCfg Text="Ajusta as Janelas em Cascata" />
</ext:Button>
</Items>
</ext:Toolbar>
</QuickStart>
</ext:Desktop>
</form>
</body>
</html>
Desktop.csClick the menu looked like this:
mniCurrent.Listeners.Click.Handler = "App.direct.SomeDirectMethod()";
the DirectMetod of looked like this: [DirectMethod]
public void SomeDirectMethod()
{
//ComponentLoader.ToConfig("TabWindows.ascx");
Window win1 = new Window();
win1.ID = "win1";
win1.Title = "Teste";
win1.Width=300;
win1.Height = 300;
Control ctrl1 = LoadControl("~/TabWindows.ascx");
ctrl1.ID = "ctrl1";
win1.ContentControls.Add(ctrl1);
win1.Show();
Desktop1.CreateWindow(win1);
}
TabWindows.ascx
<ext:Panel ID="Panel1" runat="server" Height="600" Title="Title">
<Items>
<ext:Button runat="server" Text="Click Me!" ID="button1" />
<ext:Button runat="server" Text="Click Me!" ID="button2">
</ext:Button>
<ext:TextField runat="server" ID="text1" />
</Items>
</ext:Panel>