コード例 #1
0
ファイル: LogEntry.cs プロジェクト: alaincao/CommonLibs
 internal LogEntry(ActionsManager actionsManager, string creator, string name)
     : base(actionsManager, creator, name)
 {
     StatusHelper.ValueChanged += UpdateStatus;
     ProgressHelper.ValueChanged += UpdateStatus;
     //UpdateStatus();
 }
コード例 #2
0
ファイル: Logs.xaml.cs プロジェクト: alaincao/CommonLibs
        public Logs()
        {
            ModuleObject = new ModuleObject( "Logs", this, CanSaveHelper );

            InitializeComponent();

            ActionsManager = new ActionsManager( "" )  { Dispatcher = this.Dispatcher };
            ActionsManager.ActionEntryFactory = (creator,name)=>
                {
                    return new LogEntry(ActionsManager, creator, name);
                };
            lstLogs.Items.Clear();
            lstLogs.ItemsSource = ActionsManager.ActionEntries;
            lstLogs.SelectionChanged += ES.SelectionChanged( lstLogs_SelectionChanged );

            ActionsManager.ActionStatusChanged += (actionEntry)=>
                {
                    lstLogs.Items.Refresh();
                };
        }
コード例 #3
0
        public void Init(ActionsManager actionsManager, string creator, IValueHelper<string> connectionStringValueHelper)
        {
            System.Diagnostics.Debug.Assert( Creator == null, "Init() should be called only once!" );

            Creator = creator;
            ActionsManager = actionsManager;
            IsConnectionOkHelper = new ValueHelper<bool>{ Value = false };
            ConnectionString_ValueChangedActionDelayer = new ActionHelper();

            bool hadInitialConnectionString;
            if( string.IsNullOrEmpty(connectionStringValueHelper.Value) )
            {
                // Fill control with initial values
                connectionStringValueHelper.Value = ConnectionStringHelper.SampleConnectionString;
                hadInitialConnectionString = false;
            }
            else
            {
                hadInitialConnectionString = true;
            }

            ConnectionStringHelper = new Utils.Event.ConnectionStringHelper( connectionStringValueHelper );

            // Link Show Password CheckBox
            cbShowPassword.Checked += ES.Routed( cbShowPassword_Changed );
            cbShowPassword.Unchecked += ES.Routed( cbShowPassword_Changed );
            cbShowPassword_Changed();

            // Link TextBoxes to ConnectionStringHelper

            txtServer.Text = Server;
            ConnectionStringHelper.ServerHelper.ValueChanged += ()=>{ txtServer.Text = Server; };
            txtServer.TextChanged += ES.TextChanged( ()=>{ Server = txtServer.Text; } );

            txtDatabase.Text = Database;
            ConnectionStringHelper.DatabaseHelper.ValueChanged += ()=>{ txtDatabase.Text = Database; };
            txtDatabase.TextChanged += ES.TextChanged( ()=>{ Database = txtDatabase.Text; } );

            txtUser.Text = User;
            ConnectionStringHelper.UserHelper.ValueChanged += ()=>{ txtUser.Text = User; };
            txtUser.TextChanged += ES.TextChanged( ()=>{ User = txtUser.Text; } );

            txtPasswordClear.Text =
            txtPasswordHidden.Password =
            txtPasswordConfirm.Password = Password;
            ConnectionStringHelper.PasswordHelper.ValueChanged += ()=>
                {
                    var password = Password;
                    txtPasswordClear.Text = password;
                    if( txtPasswordHidden.Password != password )	txtPasswordHidden.Password = password;
                    if( txtPasswordConfirm.Password != password )	txtPasswordConfirm.Password = password;
                };
            txtPasswordClear.TextChanged += (sender,e)=>{ Password = txtPasswordClear.Text; };
            txtPasswordHidden.PasswordChanged += ES.Routed( txtPasswordHiddenConfirm_PasswordChanged );
            txtPasswordConfirm.PasswordChanged += ES.Routed( txtPasswordHiddenConfirm_PasswordChanged );

            // Monitor ConnectionString changes

            txtConnectionString.Text = ConnectionStringHelper.GetConnectionStringWithoutPassword( PasswordHideString );
            ConnectionString_ValueChangedActionDelayer.Action = ConnectionString_ValueChangedDelayed;
            ConnectionStringHelper.ValueHelper.ValueChanged += ConnectionString_ValueChanged;

            if( hadInitialConnectionString )
                // Try connection right now if a ConnectionString is already available
                ConnectionString_ValueChangedActionDelayer.Trigger();
            // Set delay on the ConnectionString's ActionHelper
            ConnectionString_ValueChangedActionDelayer.DelaySeconds = 1;
        }
コード例 #4
0
 public void Init(ActionsManager actionsManager, string creator)
 {
     Init( actionsManager, creator, new ValueHelper<string>() );
 }
コード例 #5
0
        public void Init(ActionsManager actionsManager, string creator, string webAppFriendlyName)
        {
            System.Diagnostics.Debug.Assert( Creator == null, "Init() should be called only once!" );

            Creator = creator;
            ActionsManager = actionsManager;
            WebAppFriendlyName = webAppFriendlyName;

            Action checkPhysicalPath = ()=>CheckPhysicalPathEntry = ActionsManager.AppendAction( Creator, "Checking physical path", CheckPhysicalPath );
            Action loadWebsites = ()=>ActionsManager.AppendAction( Creator, "Load website list", LoadWebsites );
            Action loadVirtualDirectories = ()=>ActionsManager.AppendAction( Creator, "Load IIS virtual directories list", LoadVirtualDirectories );

            // Launch initialization actions
            loadWebsites();  // Will append action LoadVirtualDirectories
            checkPhysicalPath();

            // Bind controls

            btnBrowsePath.Click += ES.Routed( btnBrowsePath_Click );

            txtPhysicalPath.TextChanged += ES.TextChanged( ()=>
                {
                    imgStatus.Source = CommonLibs.Resources.WPF_SetupGui_UserControls_IISWebApplication.ImageRunning;
                    txtPhysicalPath_Delayer.Trigger();
                } );
            txtPhysicalPath_Delayer.Action = checkPhysicalPath;
            txtPhysicalPath_Delayer.DelaySeconds = 1;

            PhysicalPathHelper.ValueChanged += ES.Action( loadVirtualDirectories );
            ddWebSites.SelectionChanged += ES.SelectionChanged( loadVirtualDirectories );
            //ddVirtualDirs.TextChanged += ddVirtualDirs_TextChanged;  <= NB: Done in XAML

            btnReplace.Click += ES.Routed( ()=>ActionsManager.AppendAction(Creator, "Replacing the existing virtual directory", btnReplace_Click) );
            btnCreate.Click += ES.Routed( ()=>ActionsManager.AppendAction(Creator, "Creating a new virtual directory", btnCreate_Click) );
            btnRemove.Click += ES.Routed( ()=>ActionsManager.AppendAction(Creator, "Remove existing virtual directory", btnRemove_Click) );
        }