Hello everyone,
I use a selfmade drag 'n' drop control which opens a radpane when dropped in the Docking area.
My Problem the first time I drop the control in the docking area the undocked floating pane appears but with
a way smaller width than the content, which results in cutting the content.
When I resize the height with the mouse just a little bit the pane pops out to full width, and looks as it should (Please look at the attached Jpeg).
Now when I reopen it it has the correct width. It looks like there is a wrong initial width but the pane ignores every
parameter I send with.
Thank you in Advance for your help.
My XAML:
My C# Code behind, pane is opened in private void showActual(DropContainerControl dcc, Point point):
I use a selfmade drag 'n' drop control which opens a radpane when dropped in the Docking area.
My Problem the first time I drop the control in the docking area the undocked floating pane appears but with
a way smaller width than the content, which results in cutting the content.
When I resize the height with the mouse just a little bit the pane pops out to full width, and looks as it should (Please look at the attached Jpeg).
Now when I reopen it it has the correct width. It looks like there is a wrong initial width but the pane ignores every
parameter I send with.
Thank you in Advance for your help.
My XAML:
<
UserControl
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local
=
"clr-namespace:Access_Editor"
xmlns:Sipatec_Visualization_Environment
=
"clr-namespace:Sipatec_Visualization_Environment"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:customTheme
=
"clr-namespace:CustomTheme;assembly=CustomTheme"
mc:Ignorable
=
"d"
xmlns:SLAccessEditorAppLogin
=
"clr-namespace:SLAccessEditorAppLogin;assembly=SLAccessEditorApp_Login"
xmlns:SLAccessEditorAppUser
=
"clr-namespace:SLAccessEditorAppUser;assembly=SLAccessEditorAppU"
xmlns:SLAccessEditorAppUGroup
=
"clr-namespace:SLAccessEditorAppUGroup;assembly=SLAccessEditorAppUG"
xmlns:SLAccessEditorAppLock
=
"clr-namespace:SLAccessEditorAppLock;assembly=SLAccessEditorAppL"
xmlns:SLAccessEditorAppLGroup
=
"clr-namespace:SLAccessEditorAppLGroup;assembly=SLAccessEditorAppLG"
xmlns:SLAccessEditorAppAMap
=
"clr-namespace:SLAccessEditorAppAMap;assembly=SLAccessEditorApp_AccessMap"
xmlns:SLAccessEditorAppAccessAssist
=
"clr-namespace:SLAccessEditorAppAccessAssist;assembly=SLAccessEditorApp_AccessAssist"
xmlns:SLAccessEditorAppUtil
=
"clr-namespace:SLAccessEditorApp_Util;assembly=SLAccessEditorAppUtil"
x:Class
=
"Access_Editor.MainPage"
Width
=
"1050"
Height
=
"600"
Loaded
=
"SL_Loaded"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
MouseMove
=
"UserControl_MouseMove"
FontFamily
=
"Portable User Interface"
>
<
UserControl.Resources
>
<
customTheme:MyTheme
x:Key
=
"Theme"
/>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"Black"
MouseRightButtonDown
=
"LayoutRoot_MouseRightButtonDown"
MouseRightButtonUp
=
"LayoutRoot_MouseRightButtonUp"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
>
<
Canvas
Width
=
"0"
Height
=
"0"
x:Name
=
"Sipatec_Logo"
Canvas.ZIndex
=
"100"
RenderTransformOrigin
=
"0.5,0.5"
Margin
=
"325,133,725,467"
Visibility
=
"Collapsed"
>
<
Canvas.RenderTransform
>
<
CompositeTransform
ScaleX
=
"2"
ScaleY
=
"2"
/>
</
Canvas.RenderTransform
>
<
Canvas.Effect
>
<
DropShadowEffect
Opacity
=
"0.265"
/>
</
Canvas.Effect
>
<
Path
Opacity
=
"0.895"
OpacityMask
=
"#FF000000"
Width
=
"100.75"
Height
=
"99.25"
Fill
=
"#FF10BDDF"
Stretch
=
"Fill"
Stroke
=
"#FF000000"
Canvas.Left
=
"20.5"
Canvas.Top
=
"24.75"
Data
=
"M19.75,121.75 L119.5,23.5 119.5,46.510076 44.25,121.74748 z"
StrokeThickness
=
"0"
x:Name
=
"Path01"
/>
<
Path
Opacity
=
"0.895"
OpacityMask
=
"#FF000000"
Width
=
"70.5"
Height
=
"71.75"
Fill
=
"#FF0B1892"
Stretch
=
"Fill"
Stroke
=
"#FF000000"
Canvas.Left
=
"50.75"
Canvas.Top
=
"52.5"
Data
=
"M50,121.99652 L119.5,51.25 119.5,103.5 115.5,103.5 115.75,79.5 74.25,122 z"
StrokeThickness
=
"0"
x:Name
=
"Path02"
/>
<
TextBlock
Opacity
=
"0.895"
OpacityMask
=
"#FF000000"
Width
=
"40"
Height
=
"32"
Canvas.Left
=
"93.75"
Canvas.Top
=
"94.624"
FontWeight
=
"Bold"
TextWrapping
=
"Wrap"
Foreground
=
"#FF0B1892"
x:Name
=
"Letter_S2"
><
Run
FontFamily
=
"Arial"
FontSize
=
"36"
Text
=
"S"
/></
TextBlock
>
<
Path
Opacity
=
"0.895"
OpacityMask
=
"#FF000000"
Width
=
"4.25"
Height
=
"21"
Stretch
=
"Fill"
Stroke
=
"#FF000000"
Canvas.Left
=
"117.25"
Canvas.Top
=
"107"
Data
=
"M116.2619,105.76299 L116.46428,125.67208 119.70238,125.67208 119.5,106 z"
Fill
=
"#FF0B1892"
StrokeThickness
=
"0"
x:Name
=
"Path_i2"
/>
</
Canvas
>
<
Grid
x:Name
=
"Desktop"
Margin
=
"0,-3,0,0"
>
<
Image
x:Name
=
"Wallpaper"
Source
=
"/Images/Backg.jpg"
Stretch
=
"Fill"
Opacity
=
"0.09"
Margin
=
"0,3,0,0"
/>
<
Grid
x:Name
=
"Title"
HorizontalAlignment
=
"Left"
Height
=
"53"
Margin
=
"2,0,0,0"
VerticalAlignment
=
"Top"
Width
=
"267"
Canvas.ZIndex
=
"2"
>
<
TextBlock
x:Name
=
"Title01"
Margin
=
"0,0,66,24"
TextWrapping
=
"Wrap"
Text
=
"SL-ACCESS"
Foreground
=
"White"
FontFamily
=
"Fonts/Fonts.zip#Swis721 BlkEx BT"
FontSize
=
"24"
FontStyle
=
"Italic"
MouseLeftButtonUp
=
"debugging_MouseLeftButtonUp"
/>
<
TextBlock
x:Name
=
"Title02"
HorizontalAlignment
=
"Right"
Margin
=
"0,24,0,0"
TextWrapping
=
"Wrap"
Text
=
"Editor"
Width
=
"126"
Foreground
=
"White"
FontFamily
=
"Fonts/Fonts.zip#Swis721 BlkEx BT"
FontSize
=
"16"
FontStyle
=
"Italic"
/>
</
Grid
>
<
local:RndButton
x:Name
=
"Config_Button"
HorizontalAlignment
=
"Right"
Margin
=
"0,11,91,0"
VerticalAlignment
=
"Top"
d:LayoutOverrides
=
"Width, Height"
ImagePath
=
"/SLAccessEditorClient;component/Images/Config.png"
ToolTipService.ToolTip
=
"Öffnet die Editor Configuration."
/>
<
local:RndButton
x:Name
=
"Full_Button"
HorizontalAlignment
=
"Right"
Margin
=
"0,11,51,0"
VerticalAlignment
=
"Top"
d:LayoutOverrides
=
"Width, Height"
ImagePath
=
"/SLAccessEditorClient;component/Images/Fullscreen.png"
ToolTipService.ToolTip
=
"Wechselt in den Fullscreen Modus."
MouseLeftButtonDown
=
"Full_Button_MouseLeftButtonDown"
/>
<
local:RndButton
x:Name
=
"Close_Button"
HorizontalAlignment
=
"Right"
Margin
=
"0,11,11,0"
VerticalAlignment
=
"Top"
d:LayoutOverrides
=
"Width, Height"
ImagePath
=
"/SLAccessEditorClient;component/Images/Close.png"
ToolTipService.ToolTip
=
"Schliesst die Anwendung."
MouseLeftButtonDown
=
"Close_Button_MouseLeftButtonDown"
/>
<
Rectangle
x:Name
=
"Nav_Background"
Margin
=
"82,45,8,8"
Stroke
=
"Black"
RadiusY
=
"10"
RadiusX
=
"10"
StrokeThickness
=
"0"
>
<
Rectangle.Fill
>
<
LinearGradientBrush
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#7F292929"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#7F858383"
/>
<
GradientStop
Color
=
"#7F494646"
Offset
=
"0.246"
/>
<
GradientStop
Color
=
"#7F1D1D1D"
Offset
=
"0.712"
/>
</
LinearGradientBrush
>
</
Rectangle.Fill
>
</
Rectangle
>
<
TextBlock
x:Name
=
"debug"
HorizontalAlignment
=
"Left"
Height
=
"30"
Margin
=
"337,11,0,0"
TextWrapping
=
"Wrap"
VerticalAlignment
=
"Top"
Width
=
"137"
Canvas.ZIndex
=
"27"
Foreground
=
"White"
/>
</
Grid
>
<
Rectangle
x:Name
=
"Menu_Back"
Stroke
=
"Black"
RadiusY
=
"10"
RadiusX
=
"10"
StrokeThickness
=
"0"
RenderTransformOrigin
=
"0.5,0.5"
Margin
=
"2,44,0,6"
HorizontalAlignment
=
"Left"
Width
=
"77"
>
<
Rectangle.RenderTransform
>
<
CompositeTransform
/>
</
Rectangle.RenderTransform
>
<
Rectangle.Projection
>
<
PlaneProjection
/>
</
Rectangle.Projection
>
<
Rectangle.Fill
>
<
LinearGradientBrush
EndPoint
=
"0.925,0.485"
StartPoint
=
"0.038,0.485"
>
<
GradientStop
Color
=
"Black"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#FF858383"
/>
<
GradientStop
Color
=
"#FF494646"
Offset
=
"0.168"
/>
<
GradientStop
Color
=
"Black"
Offset
=
"0.725"
/>
<
GradientStop
Color
=
"#FF585555"
Offset
=
"0.062"
/>
</
LinearGradientBrush
>
</
Rectangle.Fill
>
</
Rectangle
>
<
Canvas
x:Name
=
"L_Sidebar"
HorizontalAlignment
=
"Left"
Height
=
"411"
Margin
=
"-236,56,0,133"
VerticalAlignment
=
"Top"
Width
=
"593"
Canvas.ZIndex
=
"50"
>
<
local:DropContainerControl
x:Name
=
"userBT"
Button_Name
=
"Benutzer"
ImagePath
=
"/SLAccessEditorClient;component/Images/Usergroup.png"
Canvas.Left
=
"240"
Canvas.Top
=
"4"
d:LayoutOverrides
=
"Width, Height"
Canvas.ZIndex
=
"1"
Clicked
=
"dropContainerBT_Clicked"
/>
<
local:DropContainerControl
x:Name
=
"userGroupBT"
Button_Name
=
"Benutzer-gruppen"
ImagePath
=
"/SLAccessEditorClient;component/Images/User.png"
Canvas.Left
=
"240"
d:LayoutOverrides
=
"Width, Height"
Canvas.Top
=
"84"
Canvas.ZIndex
=
"1"
Clicked
=
"dropContainerBT_Clicked"
/>
<
local:DropContainerControl
x:Name
=
"lockBT"
Button_Name
=
"Schlösser"
ImagePath
=
"/SLAccessEditorClient;component/Images/Lock.png"
Canvas.Left
=
"240"
d:LayoutOverrides
=
"Width, Height"
Canvas.Top
=
"170"
Canvas.ZIndex
=
"1"
Clicked
=
"dropContainerBT_Clicked"
/>
<
local:DropContainerControl
x:Name
=
"lockGroupBT"
Button_Name
=
"Schlossgruppen"
ImagePath
=
"/SLAccessEditorClient;component/Images/Lockgroup.png"
Canvas.Left
=
"240"
d:LayoutOverrides
=
"Width, Height"
Canvas.Top
=
"260"
Canvas.ZIndex
=
"1"
Clicked
=
"dropContainerBT_Clicked"
/>
<
local:DropContainerControl
x:Name
=
"accessMapBT"
Button_Name
=
"Zutritts-berechtigungen"
ImagePath
=
"/SLAccessEditorClient;component/Images/Accessright.png"
Canvas.Left
=
"240"
d:LayoutOverrides
=
"Width, Height"
Canvas.Top
=
"350"
Canvas.ZIndex
=
"1"
Clicked
=
"dropContainerBT_Clicked"
/>
<
local:DropContainerControl
x:Name
=
"accessAssistBT"
Button_Name
=
"Berechtigungs-Assistent"
ImagePath
=
"/SLAccessEditorClient;component/Images/AccessAssist.png"
Canvas.Left
=
"240"
d:LayoutOverrides
=
"Width, Height"
Canvas.Top
=
"440"
Canvas.ZIndex
=
"1"
Clicked
=
"dropContainerBT_Clicked"
/>
</
Canvas
>
<
Rectangle
x:Name
=
"OuterBorder"
Stroke
=
"Black"
StrokeThickness
=
"0"
RenderTransformOrigin
=
"0.5,0.5"
Margin
=
"0,44,205,7"
HorizontalAlignment
=
"Right"
Width
=
"3"
>
<
Rectangle.RenderTransform
>
<
CompositeTransform
/>
</
Rectangle.RenderTransform
>
<
Rectangle.Projection
>
<
PlaneProjection
/>
</
Rectangle.Projection
>
<
Rectangle.Fill
>
<
LinearGradientBrush
EndPoint
=
"0.796,0.355"
StartPoint
=
"0.022,0.355"
>
<
GradientStop
Color
=
"Black"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#FF918B8B"
/>
<
GradientStop
Color
=
"#FF494646"
Offset
=
"0.246"
/>
<
GradientStop
Color
=
"Black"
Offset
=
"0.725"
/>
</
LinearGradientBrush
>
</
Rectangle.Fill
>
</
Rectangle
>
<
Rectangle
x:Name
=
"Border_Bar"
Stroke
=
"Black"
StrokeThickness
=
"0"
RenderTransformOrigin
=
"0.5,0.5"
Margin
=
"79,44,0,8"
HorizontalAlignment
=
"Left"
Width
=
"6"
>
<
Rectangle.RenderTransform
>
<
CompositeTransform
/>
</
Rectangle.RenderTransform
>
<
Rectangle.Projection
>
<
PlaneProjection
/>
</
Rectangle.Projection
>
<
Rectangle.Fill
>
<
LinearGradientBrush
EndPoint
=
"0.843,0.114"
StartPoint
=
"-0.009,0.114"
>
<
GradientStop
Color
=
"Black"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#FF918B8B"
/>
<
GradientStop
Color
=
"#FF494646"
Offset
=
"0.246"
/>
<
GradientStop
Color
=
"Black"
Offset
=
"0.725"
/>
</
LinearGradientBrush
>
</
Rectangle.Fill
>
</
Rectangle
>
<
Canvas
x:Name
=
"R_Sidebar"
HorizontalAlignment
=
"Right"
Margin
=
"0,-42,-89,153"
Width
=
"562"
>
<
sdk:Calendar
Background
=
"{x:Null}"
BorderBrush
=
"{x:Null}"
Style
=
"{StaticResource CalendarStyleSL}"
Height
=
"191"
Canvas.Left
=
"259"
Canvas.Top
=
"298"
Width
=
"222"
/>
<
Sipatec_Visualization_Environment:Head_Clock
RenderTransformOrigin
=
"0.5,0.5"
Height
=
"381"
Canvas.Left
=
"172"
Width
=
"390"
>
<
Sipatec_Visualization_Environment:Head_Clock.RenderTransform
>
<
CompositeTransform
ScaleX
=
"0.55"
ScaleY
=
"0.55"
/>
</
Sipatec_Visualization_Environment:Head_Clock.RenderTransform
>
</
Sipatec_Visualization_Environment:Head_Clock
>
</
Canvas
>
<
Grid
x:Name
=
"DockArea"
Margin
=
"89,44,221,8"
Canvas.ZIndex
=
"1000"
>
<
telerik:RadDocking
x:Name
=
"centerDockArea"
ConstraintAutoHideArea
=
"False"
Background
=
"{x:Null}"
BorderBrush
=
"{x:Null}"
Foreground
=
"{x:Null}"
Margin
=
"0,0,-14,0"
RenderTransformOrigin
=
"1,1"
>
<
telerik:RadDocking.GeneratedItemsFactory
>
<
local:CustomGeneratedItemsFactory
/>
</
telerik:RadDocking.GeneratedItemsFactory
>
<
telerik:RadDocking.RenderTransform
>
<
CompositeTransform
/>
</
telerik:RadDocking.RenderTransform
>
<
telerik:RadDocking.DocumentHost
>
<
telerik:RadSplitContainer
x:Name
=
"Welcome"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
telerik:RadPaneGroup
x:Name
=
"WelcomePaneGroup"
telerik:StyleManager.Theme
=
"{StaticResource Theme}"
>
<
telerik:RadPane
x:Name
=
"WelcomePane"
Title
=
"Willkommen"
Background
=
"{x:Null}"
CanUserClose
=
"False"
CanFloat
=
"False"
IsHidden
=
"True"
>
<
Canvas
Margin
=
"10,160,-82,138"
Width
=
"600"
Height
=
"109"
>
<
TextBlock
TextWrapping
=
"Wrap"
Text
=
"SL-ACCESS"
Foreground
=
"White"
FontFamily
=
"Fonts/Fonts.zip#Swis721 BlkEx BT"
FontSize
=
"48"
FontStyle
=
"Italic"
FontWeight
=
"Bold"
Opacity
=
"0.845"
Height
=
"114"
Canvas.Left
=
"96"
Width
=
"445"
>
<
TextBlock.Effect
>
<
DropShadowEffect
/>
</
TextBlock.Effect
>
</
TextBlock
>
<
ed:Arc
ArcThickness
=
"1"
ArcThicknessUnit
=
"Percent"
EndAngle
=
"360"
Fill
=
"#FFF4F4F5"
Stretch
=
"None"
Stroke
=
"Black"
StartAngle
=
"90"
UseLayoutRounding
=
"False"
Width
=
"171.538"
StrokeThickness
=
"0"
RenderTransformOrigin
=
"0.5,0.5"
Opacity
=
"0.845"
Height
=
"71"
Canvas.Top
=
"17"
Canvas.Left
=
"5"
>
<
ed:Arc.Effect
>
<
DropShadowEffect
/>
</
ed:Arc.Effect
>
<
ed:Arc.RenderTransform
>
<
CompositeTransform
SkewX
=
"-13"
/>
</
ed:Arc.RenderTransform
>
</
ed:Arc
>
</
Canvas
>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
</
telerik:RadDocking.DocumentHost
>
<
telerik:RadSplitContainer
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
x:Name
=
"userSC"
>
<
telerik:RadPaneGroup
AllowDragReorder
=
"True"
x:Name
=
"userPG"
>
<
telerik:RadPane
x:Name
=
"ContUserPane"
Title
=
"Benutzer"
Unloaded
=
"ContPane_Unloaded"
IsHidden
=
"True"
>
<
SLAccessEditorAppUser:UserPage
x:Name
=
"userPage"
/>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
<
telerik:RadSplitContainer
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
telerik:RadPaneGroup
AllowDragReorder
=
"True"
>
<
telerik:RadPane
x:Name
=
"ContUGroupPane"
Title
=
"Benutzergruppen"
IsHidden
=
"True"
Unloaded
=
"ContPane_Unloaded"
>
<
SLAccessEditorAppUGroup:UGroupPage
x:Name
=
"userGroupPage"
/>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
<
telerik:RadSplitContainer
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
telerik:RadPaneGroup
AllowDragReorder
=
"True"
>
<
telerik:RadPane
x:Name
=
"ContLockPane"
Title
=
"Schlösser"
IsHidden
=
"True"
Unloaded
=
"ContPane_Unloaded"
>
<
SLAccessEditorAppLock:LockPage
x:Name
=
"lockPage"
/>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
<
telerik:RadSplitContainer
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
telerik:RadPaneGroup
AllowDragReorder
=
"True"
>
<
telerik:RadPane
x:Name
=
"ContLGroupPane"
Title
=
"Schlossgruppen"
IsHidden
=
"True"
Unloaded
=
"ContPane_Unloaded"
>
<
SLAccessEditorAppLGroup:LGroupPage
x:Name
=
"lGroupPage"
/>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
<
telerik:RadSplitContainer
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
telerik:RadPaneGroup
AllowDragReorder
=
"True"
>
<
telerik:RadPane
x:Name
=
"ContAccessMapPane"
Title
=
"Zutrittsberechtigung"
IsHidden
=
"True"
Unloaded
=
"ContPane_Unloaded"
>
<
SLAccessEditorAppAMap:AccessMapPage
x:Name
=
"accessMapPage"
/>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
<
telerik:RadSplitContainer
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
>
<
telerik:RadPaneGroup
AllowDragReorder
=
"True"
>
<!-- telerik:StyleManager.Theme="{StaticResource Theme}" -->
<
telerik:RadPane
x:Name
=
"ContAccessAssistPane"
Title
=
"Berechtigungsassistent"
IsHidden
=
"True"
Unloaded
=
"ContPane_Unloaded"
>
<
SLAccessEditorAppAccessAssist:AssistFrame
x:Name
=
"accessAssistPage"
/>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
</
telerik:RadDocking
>
</
Grid
>
<
SLAccessEditorAppLogin:LoginPage
Name
=
"loginPage"
HorizontalAlignment
=
"Left"
Margin
=
"240,0,0,0"
VerticalAlignment
=
"Top"
/>
<
SLAccessEditorAppUtil:BusyIndicator
x:Name
=
"busyIndicator"
Margin
=
"0"
Visibility
=
"Collapsed"
BusyTextContent
=
""
Canvas.ZIndex
=
"9000"
IsIndeterminant
=
"True"
/>
</
Grid
>
</
UserControl
>
My C# Code behind, pane is opened in private void showActual(DropContainerControl dcc, Point point):
using
System;
using
System.Windows;
using
System.Windows.Browser;
using
System.Windows.Controls;
using
SLAccessEditorApp_Util;
using
SLAccessEditorAppLogin;
using
Telerik.Windows.Controls;
using
CustomTheme;
using
System.Windows.Threading;
namespace
Access_Editor
{
public
partial
class
MainPage : UserControl
{
private
double
_oldWidth;
//double for the origin width.
private
double
_oldHeight;
//double for the origin height.
public
double
uniformScaleAmount = 1;
// double for the scalefactor.
private
DropContainerControl[] buttonList;
private
RadPane[] paneList;
private
DispatcherTimer logOffTimer;
private
DispatcherTimer activeTimer;
public
bool
IsActive {
get
;
set
; }
public
MainPage()
{
// Required to initialize variables
InitializeComponent();
buttonList =
new
DropContainerControl[6];
buttonList[0] = userBT;
buttonList[1] = userGroupBT;
buttonList[2] = lockBT;
buttonList[3] = lockGroupBT;
buttonList[4] = accessMapBT;
buttonList[5] = accessAssistBT;
paneList =
new
RadPane[6];
paneList[0] = ContUserPane;
paneList[1] = ContUGroupPane;
paneList[2] = ContLockPane;
paneList[3] = ContLGroupPane;
paneList[4] = ContAccessMapPane;
paneList[5] = ContAccessAssistPane;
// LoginPage loginEvent geristrieren
loginPage.loginEvent +=
new
LoginPage.LoginEventHandler(loginPage_loginEvent);
loginPage.statusEvent +=
new
LoginPage.StatusMessageEventHandler(loginPage_statusEvent);
busyIndicator.CancelClicked +=
new
EventHandler(busyIndicator_CancelClicked);
// minWidth für die RadPanes festlegen
(centerDockArea.GeneratedItemsFactory
as
CustomGeneratedItemsFactory).minWidthAttrib = 700;
(centerDockArea.GeneratedItemsFactory
as
CustomGeneratedItemsFactory).minHightAttrib = 250;
// Timer zur logoutüberwachung initialisieren
IsActive =
true
;
activeTimer =
new
System.Windows.Threading.DispatcherTimer();
activeTimer.Tick +=
new
EventHandler(activeTimer_Tick);
initActiveTimer();
}
// Timer konfigurieren, der nach Ablauf eine Inaktivität dieses Controls signalisiert
internal
void
initActiveTimer() {
//sLAccessEditorClient.
IsActive =
true
;
activeTimer.Interval = TimeSpan.FromSeconds(10);
activeTimer.Start();
}
void
activeTimer_Tick(
object
sender, EventArgs e) {
IsActive =
false
;
}
void
loginPage_loginEvent(
object
sender, LoginEventArgs e) {
// Logininformationen an Unterfenster weitergeben
if
(e.LoginSuccessfull) {
userPage.init(e.ServerBindungName, e.ServerAddress, e.UserName, e.SaltedPassword);
userGroupPage.init(e.ServerBindungName, e.ServerAddress, e.UserName, e.SaltedPassword);
lockPage.init(e.ServerBindungName, e.ServerAddress, e.UserName, e.SaltedPassword);
lGroupPage.init(e.ServerBindungName, e.ServerAddress, e.UserName, e.SaltedPassword);
accessMapPage.init(e.ServerBindungName, e.ServerAddress, e.UserName, e.SaltedPassword);
accessAssistPage.init(e.ServerBindungName, e.ServerAddress, e.UserName, e.SaltedPassword);
// logoffTimer initialisieren
logOffTimer =
new
System.Windows.Threading.DispatcherTimer();
logOffTimer.Interval = TimeSpan.FromSeconds(1);
logOffTimer.Tick +=
new
EventHandler(logOffTimer_Tick);
logOffTimer.Start();
}
else
{
userPage.logout();
userGroupPage.logout();
lockPage.logout();
lGroupPage.logout();
accessMapPage.logout();
accessAssistPage.logout();
if
(logOffTimer !=
null
) {
logOffTimer.Stop();
logOffTimer.Tick -= logOffTimer_Tick;
logOffTimer =
null
;
}
}
}
void
loginPage_statusEvent(
object
sender, StatusEventArgs e)
{
if
( e.StatusMessageType == EnumStatusMessageType.BusyMessage )
{
// Progress aktualisieren
if
(e.StatusProgress >= 0)
{
busyIndicator.IsIndeterminant =
false
;
busyIndicator.Progress = e.StatusProgress;
}
else
{
busyIndicator.IsIndeterminant =
true
;
}
// Message aktualisieren
busyIndicator.BusyTextContent = e.StatusMessage;
}
else
{
// MessageWindow anzeigen
MessageWindow.show(e.StatusMessage);
}
}
void
busyIndicator_CancelClicked(
object
sender, EventArgs e) {
// busyindicator ausblenden
busyIndicator.BusyTextContent =
""
;
}
void
logOffTimer_Tick(
object
sender, EventArgs e) {
if
((!IsActive) &&
// MainPage
(userPage !=
null
&& !userPage.IsActive) &&
(userGroupPage !=
null
&& !userGroupPage.IsActive) &&
(lockPage !=
null
&& !lockPage.IsActive) &&
(lGroupPage !=
null
&& !lGroupPage.IsActive) &&
(accessMapPage !=
null
&& !accessMapPage.IsActive) &&
(accessAssistPage !=
null
&& !(accessAssistPage
as
SLAccessEditorAppAccessAssist.AssistFrame).IsActive)
) {
// louout veranlassen
loginPage.logout();
// timer stoppen
if
(logOffTimer !=
null
) {
logOffTimer.Stop();
}
MessageWindow.show(
"Die Verbindung wurde wegen Inaktivität getrennt"
);
}
}
void
SL_Loaded(
object
sender, RoutedEventArgs e)
// This eventhandler triggers when XAML is loaded.
{
_oldHeight =
this
.Height;
//Assigns the opening height of the browser to the original width of the control window.
_oldWidth =
this
.Width;
//Assigns the opening width of the browser to the original width of the control window.
Application.Current.Host.Content.Resized +=
new
EventHandler(Content_Resized);
//Releases the event Content_Resized when resizing the browser.
Application.Current.Host.Content.FullScreenChanged +=
new
EventHandler(Content_Resized);
//Releases the event Content_Resized when browser set to fullscreen.
}
void
Content_Resized(
object
sender, EventArgs e)
//Eventhandler Content_Resized
{
double
currentWidth = Application.Current.Host.Content.ActualWidth;
//Conversion of the current width in Double.
double
currentHeight = Application.Current.Host.Content.ActualHeight;
//Conversion of the current height in Double
double
WidthScaleAmount = currentWidth / _oldWidth;
double
HeightScaleAmount = currentHeight / _oldHeight;
//Calculation of the screen ratio.
double
newHeight = _oldHeight * HeightScaleAmount;
//Writes the X-Ratio in XAML.
double
newWidth = _oldWidth * WidthScaleAmount;
//Writes the Y-Ratio in XAML.
if
(newHeight > currentHeight)
{
newHeight = currentHeight;
}
if
(newHeight < 484)
{
newHeight = 484;
}
if
(newWidth > currentWidth)
{
newWidth = currentWidth;
}
if
(newWidth < 287)
{
newWidth = 287;
}
this
.Height = newHeight;
this
.Width = newWidth;
}
private
void
Full_Button_MouseLeftButtonDown(
object
sender, System.Windows.Input.MouseButtonEventArgs e)
{
Application.Current.Host.Content.IsFullScreen = !Application.Current.Host.Content.IsFullScreen;
//Toggle function for fullscreen.
}
private
void
Close_Button_MouseLeftButtonDown(
object
sender, System.Windows.Input.MouseButtonEventArgs e)
{
HtmlPage.Window.Invoke(
"CloseWindow"
);
}
private
void
LayoutRoot_MouseRightButtonDown(
object
sender, System.Windows.Input.MouseButtonEventArgs e)
{
e.Handled =
true
;
this
.Sipatec_Logo.Visibility = Visibility.Visible;
}
private
void
LayoutRoot_MouseRightButtonUp(
object
sender, System.Windows.Input.MouseButtonEventArgs e)
{
e.Handled =
true
;
this
.Sipatec_Logo.Visibility = Visibility.Collapsed;
}
private
void
dropContainerBT_Clicked(
object
sender, DropContainerControl.ClickedEventArgs e) {
if
( sender ==
null
|| e ==
null
)
return
;
if
( e.IsDroped ) {
showActual(sender
as
DropContainerControl, e.DropPoint);
}
else
{
showActualHideOthers(sender
as
DropContainerControl);
}
}
private
void
showActual(DropContainerControl dcc, Point point) {
if
( dcc ==
null
)
return
;
this
.WelcomePane.IsHidden =
true
;
for
(
int
i = 0; i < buttonList.Length; i++ ) {
if
( buttonList[i] == dcc ) {
paneList[i].IsHidden =
false
;
paneList[i].IsPinned =
true
;
paneList[i].MakeFloatingDockable();
refreshPaneContent(paneList[i]);
}
}
}
private
void
showActualHideOthers(DropContainerControl dcc)
{
if
( dcc ==
null
)
return
;
this
.WelcomePane.IsHidden =
true
;
for
(
int
i = 0; i < buttonList.Length; i++)
{
if
(buttonList[i] == dcc)
{
paneList[i].IsHidden =
false
;
paneList[i].IsPinned =
true
;
paneList[i].MoveToDocumentHost();
refreshPaneContent(paneList[i]);
}
else
{
buttonList[i].GUIclose();
if
( paneList[i].IsInDocumentHost ) {
paneList[i].IsHidden =
true
;
}
}
}
}
private
void
ContPane_Unloaded(
object
sender, RoutedEventArgs e) {
RadPane rp = sender
as
RadPane;
if
( rp ==
null
)
return
;
// Den Button wieder sichtbar machen
for
(
int
i = 0; i < buttonList.Length; i++ ) {
if
( paneList[i] == rp ) {
buttonList[i].GUIclose();
}
}
}
private
void
refreshPaneContent(RadPane rp) {
if
( rp ==
null
|| rp.Content ==
null
)
return
;
if
( rp.Content
is
SLAccessEditorAppUser.UserPage )
(rp.Content
as
SLAccessEditorAppUser.UserPage).refreshUserList();
else
if
( rp.Content
is
SLAccessEditorAppUGroup.UGroupPage )
(rp.Content
as
SLAccessEditorAppUGroup.UGroupPage).refreshUGroupList();
else
if
( rp.Content
is
SLAccessEditorAppLock.LockPage )
(rp.Content
as
SLAccessEditorAppLock.LockPage).refreshList();
else
if
( rp.Content
is
SLAccessEditorAppLGroup.LGroupPage )
(rp.Content
as
SLAccessEditorAppLGroup.LGroupPage).refreshLGroupList();
else
if
( rp.Content
is
SLAccessEditorAppAMap.AccessMapPage )
(rp.Content
as
SLAccessEditorAppAMap.AccessMapPage).refreshAccMap();
else
if
( rp.Content
is
SLAccessEditorAppAccessAssist.AssistFrame )
(rp.Content
as
SLAccessEditorAppAccessAssist.AssistFrame).refresh();
}
private
void
debugging_MouseLeftButtonUp(
object
sender, System.Windows.Input.MouseButtonEventArgs e) {
try
{
//StyleManager.SetTheme(centerDockArea, new MyTheme());
/*var window = ContUserPane.GetParentToolWindow();
if( window != null ) {
window.Width = 100;
window.Height = 100;
}
*/
}
catch
( Exception ex ) {
MessageBox.Show(ex.Message);
}
}
private
void
UserControl_MouseMove(
object
sender, System.Windows.Input.MouseEventArgs e) {
if
(activeTimer !=
null
) {
// Timer zurücksetzen
initActiveTimer();
}
}
}
}