Ejemplo n.º 1
0
        void OnInstanceUpdated(MemCacheDManager.Business.Server server, MemCacheDManager.Business.Instance instance, MemCacheDManager.Business.InstanceStatistics instanceStatistics)
        {
            Business.InstanceStatistics targetStatistics = _instanceStatistics.Find(new Predicate <MemCacheDManager.Business.InstanceStatistics>(delegate(MemCacheDManager.Business.InstanceStatistics testValue)
            {
                return(testValue.Instance == instance);
            }));

            if (targetStatistics != null)
            {
                _instanceStatistics[_instanceStatistics.IndexOf(targetStatistics)] = instanceStatistics;
            }
            else
            {
                _instanceStatistics.Add(instanceStatistics);
            }

            if (this.InvokeRequired == true)
            {
                if (_isFormClosing == false)
                {
                    this.Invoke(new UpdateInstanceStatisticsDelegate(delegate(List <Business.InstanceStatistics> updateStatistics)
                    {
                        UpdateInstanceStatistics(updateStatistics);
                    }), new object[] { _instanceStatistics });
                }
            }
            else
            {
                UpdateInstanceStatistics(_instanceStatistics);
            }
        }
Ejemplo n.º 2
0
        public void CreateNew(Business.EditableEntityBase parent)
        {
            _server = null;

            txtServerName.Text = "";
            txtUserName.Text = "";
            txtPassword.Text = "";
            chkUseImpersonation.Checked = false;
            txtBinaryPath.Text = @"C:\Program Files\MemCacheD\memcached.exe";

            btnApply.Enabled = false;
            btnAddInstance.Enabled = false;
        }
Ejemplo n.º 3
0
        public void CreateNew(Business.EditableEntityBase parent)
        {
            _server = null;

            txtServerName.Text          = "";
            txtUserName.Text            = "";
            txtPassword.Text            = "";
            chkUseImpersonation.Checked = false;
            txtBinaryPath.Text          = @"C:\Program Files\MemCacheD\memcached.exe";

            btnApply.Enabled       = false;
            btnAddInstance.Enabled = false;
        }
Ejemplo n.º 4
0
        public void Edit(Business.EditableEntityBase entityToEdit, Business.EditableEntityBase parentEntity)
        {
            Business.Server server = (Business.Server)entityToEdit;

            txtServerName.Text          = server.ServerName;
            chkUseImpersonation.Checked = server.UseImpersonation;
            txtUserName.Text            = server.UserName;

            if (server.BinaryPath != null && server.BinaryPath != String.Empty)
            {
                txtBinaryPath.Text = server.BinaryPath;
            }

            if (server.Password.Length > 0)
            {
                txtPassword.Text = Encryption.Decrypt(server.Password);
            }
            else
            {
                txtPassword.Text = "";
            }

            _server = server;

            btnApply.Enabled = false;

            if (_server == null)
            {
                btnCancel.Enabled      = true;
                btnAddInstance.Enabled = false;
            }
            else
            {
                btnCancel.Enabled      = false;
                btnAddInstance.Enabled = true;
            }
        }
Ejemplo n.º 5
0
        public void Edit(Business.EditableEntityBase entityToEdit, Business.EditableEntityBase parentEntity)
        {
            Business.Server server = (Business.Server)entityToEdit;

            txtServerName.Text = server.ServerName;
            chkUseImpersonation.Checked = server.UseImpersonation;
            txtUserName.Text = server.UserName;

            if (server.BinaryPath != null && server.BinaryPath != String.Empty)
                txtBinaryPath.Text = server.BinaryPath;

            if (server.Password.Length > 0)
                txtPassword.Text = Encryption.Decrypt(server.Password);
            else
                txtPassword.Text = "";

            _server = server;

            btnApply.Enabled = false;

            if (_server == null)
            {
                btnCancel.Enabled = true;
                btnAddInstance.Enabled = false;
            }
            else
            {
                btnCancel.Enabled = false;
                btnAddInstance.Enabled = true;
            }
        }
Ejemplo n.º 6
0
        private void SaveChanges()
        {
            Cursor = Cursors.WaitCursor;

            try
            {
                SetStatusLabel("Checking server name.");

                if (IsUserAccountInfomationValid() == false)
                    return;

                if (IsServerNameAcceptable() == false)
                    return;

                if (DoesServerNameAlreadyExistInList() == true)
                    return;

                string userName = null;
                string password = null;
                if (chkUseImpersonation.Checked == true)
                {
                    userName = txtUserName.Text;
                    password = txtPassword.Text;
                }

                SetStatusLabel("Checking connection and authorization.");

                // Test the credentials.
                try
                {
                    WmiService.GetAllServices(txtServerName.Text, userName, password, "PathName LIKE '%memcached%'");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Couldn't connect to the server. Please check server connectivity and user name and password.\n" + ex.Message);
                    return;
                }

                if (_server == null)
                {
                    _server = new MemCacheDManager.Business.Server();

                    ServerConfiguration.Servers.Add(_server);
                }

                _server.ServerName = txtServerName.Text;
                _server.UserName = txtUserName.Text;
                _server.Password = Encryption.Encrypt(txtPassword.Text);
                _server.UseImpersonation = chkUseImpersonation.Checked;
                _server.BinaryPath = txtBinaryPath.Text;

                SetStatusLabel("Checking for MemCacheD instances.");

                _server.ReadInstancesFromServer();

                SetStatusLabel("Saving.");

                ServerConfiguration.Save(Configuration.Default.LastConfigFile);

                btnApply.Enabled = false;
                btnCancel.Enabled = false;
                btnAddInstance.Enabled = true;

                SetStatusLabel("Updating UI.");

                if (Save != null)
                    Save(this._server);
            }
            finally
            {
                Cursor = Cursors.Default;
                SetStatusLabel("Ready.");
            }
        }
Ejemplo n.º 7
0
        private void SaveChanges()
        {
            Cursor = Cursors.WaitCursor;

            try
            {
                SetStatusLabel("Checking server name.");

                if (IsUserAccountInfomationValid() == false)
                {
                    return;
                }

                if (IsServerNameAcceptable() == false)
                {
                    return;
                }

                if (DoesServerNameAlreadyExistInList() == true)
                {
                    return;
                }

                string userName = null;
                string password = null;
                if (chkUseImpersonation.Checked == true)
                {
                    userName = txtUserName.Text;
                    password = txtPassword.Text;
                }

                SetStatusLabel("Checking connection and authorization.");

                // Test the credentials.
                try
                {
                    WmiService.GetAllServices(txtServerName.Text, userName, password, "PathName LIKE '%memcached%'");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Couldn't connect to the server. Please check server connectivity and user name and password.\n" + ex.Message);
                    return;
                }

                if (_server == null)
                {
                    _server = new MemCacheDManager.Business.Server();

                    ServerConfiguration.Servers.Add(_server);
                }

                _server.ServerName       = txtServerName.Text;
                _server.UserName         = txtUserName.Text;
                _server.Password         = Encryption.Encrypt(txtPassword.Text);
                _server.UseImpersonation = chkUseImpersonation.Checked;
                _server.BinaryPath       = txtBinaryPath.Text;

                SetStatusLabel("Checking for MemCacheD instances.");

                _server.ReadInstancesFromServer();

                SetStatusLabel("Saving.");

                ServerConfiguration.Save(Configuration.Default.LastConfigFile);

                btnApply.Enabled       = false;
                btnCancel.Enabled      = false;
                btnAddInstance.Enabled = true;

                SetStatusLabel("Updating UI.");

                if (Save != null)
                {
                    Save(this._server);
                }
            }
            finally
            {
                Cursor = Cursors.Default;
                SetStatusLabel("Ready.");
            }
        }
Ejemplo n.º 8
0
 void OnAddInstance(MemCacheDManager.Business.Server server)
 {
     TryToChangeView(null, server, _instanceDetails);
 }