public StickyWindowModel(string DeSerializeXML) { this.Name = String.Format("stickyWindow_{0}", DateTime.Now.Ticks.ToString()); this.MinHeight = 50; this.MinWidth = 100; this.MaxHeight = 600; this.MaxWidth = 600; this.MyWindowState = WindowState.Normal; this.Background = Brushes.Transparent; this.AllowsTransparency = true; this.WindowStyle = WindowStyle.None; this.Title = "stickyWindow"; this.ShowInTaskbar = false; IconBitmapDecoder icon = new IconBitmapDecoder(iconUri, BitmapCreateOptions.None, BitmapCacheOption.Default); this.Icon = icon.Frames[0]; this.Show(); if (DeSerializeXML != null) { Deserialize(DeSerializeXML); } else { this.color = Colors.LightBlue; this.textColor = Colors.Black; Size oSize = new Size(200, 200); this.OriginalSize = oSize; } #region Event/Bindings Wireup this.SetContainerCanvasBindings(SetBindingMode.SetBinding); this.sSlider.MouseEnter += new MouseEventHandler(slider_MouseEnter); this.sSlider.MouseLeave += new MouseEventHandler(slider_MouseLeave); this.AddHandler(ScrollViewer.ScrollChangedEvent, new RoutedEventHandler(scroller_ScrollChanged)); this.sContextCircle.MouseLeftButtonDown += new MouseButtonEventHandler(contextCircle_MouseLeftButtonDown); //this.sTextArea.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(txt_LostKeyboardFocus); //this.sTextArea.MouseDoubleClick += new MouseButtonEventHandler(txt_MouseDoubleClick); this.MouseLeftButtonDown += new MouseButtonEventHandler(StickyWindowModel_MouseLeftButtonDown); SetContextCircleMouseEventBindings(SetBindingMode.SetBinding); #endregion #region CommandBindings StickyWindowCommands commands = new StickyWindowCommands(this); this.sContextCircle.ContextMenu = commands.GetContextMenu(); CommandBinding CloseCmdBinding = new CommandBinding(CloseCmd, commands.CloseCmdExecuted, commands.CloseCmdCanExecute); CommandBinding MinimizeCmdBinding = new CommandBinding(MinimizeCmd, commands.MinizmizeCmdExecuted, commands.MinizmizeCmdCanExecute); CommandBinding FitContentCmdBinding = new CommandBinding(FitContentCmd, commands.FitContentCmdExecuted, commands.FitContentCmdCanExecute); CommandBinding RestoreCmdBinding = new CommandBinding(RestoreCmd, commands.RestoreCmdExecuted, commands.RestoreCmdCanExecute); CommandBinding PrintCmdBinding = new CommandBinding(PrintCmd, commands.PrintCmdExecuted, commands.PrintCmdCanExecute); CommandBinding ColorsCmdBinding = new CommandBinding(ColorsCmd, commands.ColorsCmdExecuted, commands.ColorsCmdCanExecute); this.CommandBindings.Add(CloseCmdBinding); this.CommandBindings.Add(MinimizeCmdBinding); this.CommandBindings.Add(FitContentCmdBinding); this.CommandBindings.Add(RestoreCmdBinding); this.CommandBindings.Add(PrintCmdBinding); this.CommandBindings.Add(ColorsCmdBinding); #endregion this.Opacity = 1; }
public StickyWindowModel(string DeSerializeXML) { this.Name = String.Format("stickyWindow_{0}", DateTime.Now.Ticks.ToString()); this.MinHeight = 50; this.MinWidth = 100; this.MaxHeight = 600; this.MaxWidth = 600; this.MyWindowState = WindowState.Normal; this.Background = Brushes.Transparent; this.AllowsTransparency = true; this.WindowStyle = WindowStyle.None; this.Title = "stickyWindow"; this.ShowInTaskbar = false; IconBitmapDecoder icon = new IconBitmapDecoder(iconUri, BitmapCreateOptions.None, BitmapCacheOption.Default); this.Icon = icon.Frames[0]; this.Show(); if (DeSerializeXML != null) Deserialize(DeSerializeXML); else { this.color = Colors.LightBlue; this.textColor = Colors.Black; Size oSize = new Size(200, 200); this.OriginalSize = oSize; } #region Event/Bindings Wireup this.SetContainerCanvasBindings(SetBindingMode.SetBinding); this.sSlider.MouseEnter += new MouseEventHandler(slider_MouseEnter); this.sSlider.MouseLeave += new MouseEventHandler(slider_MouseLeave); this.AddHandler(ScrollViewer.ScrollChangedEvent, new RoutedEventHandler(scroller_ScrollChanged)); this.sContextCircle.MouseLeftButtonDown += new MouseButtonEventHandler(contextCircle_MouseLeftButtonDown); //this.sTextArea.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(txt_LostKeyboardFocus); //this.sTextArea.MouseDoubleClick += new MouseButtonEventHandler(txt_MouseDoubleClick); this.MouseLeftButtonDown += new MouseButtonEventHandler(StickyWindowModel_MouseLeftButtonDown); SetContextCircleMouseEventBindings(SetBindingMode.SetBinding); #endregion #region CommandBindings StickyWindowCommands commands = new StickyWindowCommands(this); this.sContextCircle.ContextMenu = commands.GetContextMenu(); CommandBinding CloseCmdBinding = new CommandBinding(CloseCmd, commands.CloseCmdExecuted, commands.CloseCmdCanExecute); CommandBinding MinimizeCmdBinding = new CommandBinding(MinimizeCmd, commands.MinizmizeCmdExecuted, commands.MinizmizeCmdCanExecute); CommandBinding FitContentCmdBinding = new CommandBinding(FitContentCmd, commands.FitContentCmdExecuted, commands.FitContentCmdCanExecute); CommandBinding RestoreCmdBinding = new CommandBinding(RestoreCmd, commands.RestoreCmdExecuted, commands.RestoreCmdCanExecute); CommandBinding PrintCmdBinding = new CommandBinding(PrintCmd, commands.PrintCmdExecuted, commands.PrintCmdCanExecute); CommandBinding ColorsCmdBinding = new CommandBinding(ColorsCmd, commands.ColorsCmdExecuted, commands.ColorsCmdCanExecute); this.CommandBindings.Add(CloseCmdBinding); this.CommandBindings.Add(MinimizeCmdBinding); this.CommandBindings.Add(FitContentCmdBinding); this.CommandBindings.Add(RestoreCmdBinding); this.CommandBindings.Add(PrintCmdBinding); this.CommandBindings.Add(ColorsCmdBinding); #endregion this.Opacity = 1; }