- Olbert_Utilities.zip
- Olbert.Utilities
- CryptorLib
- documentation
- bin
- Content Layout.content
- Creative Commons Attribution Share Alike.aml
- Cryptor Overview.aml
- GLPL.aml
- GPL.aml
- Licenses.aml
- Miscellaneous Utilities Overview.aml
- nHydrate Installer Overview.aml
- nHydrate Utilities.aml
- Olbert.Utils.shfbproj
- Open Source License v3.aml
- overview.aml
- Release Notes.aml
- Wizard Framework.aml
- WPF Utilities.aml
- MiscUtilities
- MiscUtilitiesCore
- nHydrateInstaller
- nHydrateUtils
- NotMine
- NotMineWPF
- OlbertUtilities.sln
- OlbertUtilities.suo
- WPFUtilities
- WPFWizard
|
/*
* Olbert.Utilities.nHydrate
* utilities for simplifying the use of nHydrate entities in WPF applications
* Copyright (C) 2011 Mark A. Olbert
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Olbert.Utilities;
namespace Olbert.Utilities.WPF
{
/// <summary>
/// A class, derived from WizardPage, which allows a user to define the server
/// containing the database being configured within the nHydrate configuration wizard
/// </summary>
public partial class ServerPage : WizardPage
{
/// <summary>
/// A DependencyProperty containing the server's name or IP address
/// </summary>
public static readonly DependencyProperty ServerProperty =
DependencyProperty.Register("Server", typeof(String), typeof(ServerPage),
new FrameworkPropertyMetadata(String.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
/// <summary>
/// A DependencyProperty containing the FlowDocument to be displayed when the user clicks the more info
/// link
/// </summary>
public static readonly DependencyProperty MoreInfoProperty =
DependencyProperty.Register("MoreInfo", typeof(FlowDocument), typeof(ServerPage), new UIPropertyMetadata(null));
/// <summary>
/// Initializes an instance
/// </summary>
public ServerPage()
{
}
/// <summary>
/// Gets or sets the server name or IP address
/// </summary>
public string Server
{
get { return (string) GetValue(ServerProperty); }
set { SetValue(ServerProperty, value); }
}
/// <summary>
/// Gets or sets the FlowDocument to be displayed in a help window when the user clicks the more
/// info link
/// </summary>
public FlowDocument MoreInfo
{
get { return (FlowDocument) GetValue(MoreInfoProperty); }
set { SetValue(MoreInfoProperty, value); }
}
/// <summary>
/// Overrides the base implementation to bind the CanMoveNext property to whether or
/// not a server name or IP address was defined
/// </summary>
protected override void SetCustomBindings()
{
base.SetCustomBindings();
// bind the CanMoveNext property to there being text in cbxServer's internal textbox
// note that this can't be done in the constructor, as the visual tree isn't built yet
// at that point, apparently
TextBox intlTextbox = cbxServer.Template.FindName("PART_EditableTextBox", cbxServer) as TextBox;
Binding newBinding = new Binding();
newBinding.Source = intlTextbox;
newBinding.Path = new PropertyPath("Text.Length", null);
newBinding.Mode = BindingMode.OneWay; // has to be oneway because Text.Length is read-only
this.SetBinding(ServerPage.CanMoveNextProperty, newBinding);
}
private void btnMoreInfo_Click( object sender, RoutedEventArgs e )
{
FlowDocumentViewer.ShowDialog(MoreInfo, "Server Selection Info");
}
private void cbxServer_DropDownOpened( object sender, EventArgs e )
{
Cursor = Cursors.Wait;
cbxServer.ItemsSource = SqlServerFinder.GetServers();
Cursor = Cursors.Arrow;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Some people like to do crossword puzzles to hone their problem-solving skills. Me, I like to write software for the same reason.
A few years back I passed my 50th anniversary of programming. I believe that means it's officially more than a hobby or pastime. In fact, it may qualify as an addiction
.
I mostly work in C# and Windows. But I also play around with Linux (mostly Debian on Raspberry Pis) and Python.