Ejemplo n.º 1
0
 //! \brief Create a toolbox window from the template object given.
 public Window(WindowTemplate template)
 {
     template.CreateBuffer();
     Create(template.Buffer);
     WimpWindow = new Wimp.WindowHandle(WimpHandle);
     RetrieveEventCodes(template.Buffer);
 }
Ejemplo n.º 2
0
 private void CreateAndShowDialog()
 {
     if (WindowTemplate != null)
     {
         //Quietly fail if the cast is no good.
         this._window = WindowTemplate.LoadContent() as Window;
         if (this._window != null)
         {
             this._window.Owner   = this._parentWindow;
             this._window.Closed += this._dialogWindowClosedEventHandler;
             Binding contentTemplateSelectorBinding = new Binding("SurrogateContentTemplateSelector");
             contentTemplateSelectorBinding.Source = this;
             BindingOperations.SetBinding(this._window, ContentControl.ContentTemplateSelectorProperty, contentTemplateSelectorBinding);
             //this._window.ContentTemplateSelector = this._tunnelDataTemplateSelector;
             BindControlToWindow("ContentStringFormat", ContentControl.ContentStringFormatProperty);
             BindControlToWindow("ContentTemplate", ContentControl.ContentTemplateProperty);
             BindControlToWindow("DataContext", FrameworkElement.DataContextProperty);
             BindControlToWindow("Content", ContentControl.ContentProperty);
             string originalTitle = this._window.Title;
             BindControlToWindow("Title", Window.TitleProperty);
             if (this.Title == null)
             {
                 this._window.Title = originalTitle;
             }
             this._window.ShowDialog();
         }
     }
 }
Ejemplo n.º 3
0
        public void GenerateCode(object obj)
        {
            var gen = new XamlGenerator();

            LoadMockup();
            gen.MockupHolder = MockupHolder;
            gen.Generate();
            RequiredNamespaces = gen.NamespaceHeader;
            GeneratedCode      = gen.GeneratedCode;
            WindowXaml         = WindowTemplate.Replace("{Namespaces}", gen.NamespaceHeader).Replace("{Height}", gen.MockupHolder.Mockup.Height.ToString())
                                 .Replace("{Width}", gen.MockupHolder.Mockup.Width.ToString())
                                 .Replace("{LayoutRoot}", gen.GeneratedCode)
                                 .Replace("{Title}", "Title")
                                 .Replace("{Resources}", gen.ResourceHeader);
        }
Ejemplo n.º 4
0
        /// Setup() gets called immediately after Application.Start(), and we can override this to provide custom
        /// initialization code.
        ///
        /// The first thing we need to do in this method, however, is call the base method - this
        /// initializes libtcod, opening the system window and setting the font, all according to the options provided in
        /// the ApplicationInfo parameter.
        ///
        /// After calling the base method, we add our setup code, in this case creating the MyWindow (defined below) object
        /// and setting it as the current Window.
        protected override void Setup(ApplicationInfo info)
        {
            /// One thing to note: in almost all cases, when overriding a framework method it is necessary
            /// to call the base method first.  The base methods handle most of the gritty details of triggering
            /// events, propagating messages, and calling the necessary stub methods.
            base.Setup(info);

            /// Just use the default options in the WindowTemplate.
            WindowTemplate mainWindowTemplate = new WindowTemplate();

            /// Create the mainWindow with the options specified in mainWindowInfo.  We define MyWindow below.
            MyWindow mainWindow = new MyWindow(mainWindowTemplate);

            /// Set the mainWindow to be MyApplication's window.  Note that if we don't set the application window,
            /// a default one is created and set automatically.
            SetWindow(mainWindow);
        }
Ejemplo n.º 5
0
 public MyWindow(WindowTemplate template)
     : base(template)
 {
 }
Ejemplo n.º 6
0
 /// The constructor has been modified so that it must be passed a Player object, which
 /// we will store in a field for later use.
 public MyWindow(WindowTemplate template, Player player)
     : base(template)
 {
     this.player = player;
 }