/// <summary>
        /// Método llamado cuando se selecciona "Seleccionar".
        /// Abre el formulario adecuado de acuerdo a la selección del usuario.
        /// </summary>
        /// <param name="sender">
        /// El objeto que genero el evento
        /// </param>
        /// <param name="e">
        /// Un objeto que contiene información sobre el evento
        /// </param>
        private void menuItemSelect_Click(object sender, EventArgs e)
        {
            ListViewItem itemSelected = listViewConfigurationOption.FocusedItem;

            if (itemSelected == null)
            {
                return;
            }

            switch (itemSelected.Index)
            {
            case 0:
                MallConfigurationForm mallConfigurationForm = new MallConfigurationForm();
                mallConfigurationForm.Owner = this;
                mallConfigurationForm.ShowDialog();
                break;

            case 1:
                CustomerConfigurationForm customerConfigurationForm = new CustomerConfigurationForm();
                customerConfigurationForm.Owner = this;
                customerConfigurationForm.ShowDialog();
                break;

            case 2:
                HelpForm helpForm = new HelpForm(global::PresentationLayer.GeneralResources.ConfigurationHelp);
                helpForm.ShowDialog();
                break;

            default: break;
            }
        }
Пример #2
0
        /// <summary>
        /// Lee la configuración del servidor desde el archivo XML de configuración.
        /// Si no existe muestra un formulario para solicitar la información del servidor.
        /// </summary>
        public void ConfigureMall()
        {
            bool existMallServerConfiguration = ReadConfigFileMallServer();

            if (!existMallServerConfiguration)
            {
                MallConfigurationForm mallConfigurationForm = new MallConfigurationForm();
                mallConfigurationForm.Owner = mainMenu;
                mallConfigurationForm.ShowDialog();
                ReadConfigFileMallServer();
            }

            UtnEmall.Client.SmartClientLayer.Connection.ServerUri = new Uri("http://" + ipServer + ":8081");
        }
Пример #3
0
        /// <summary>
        /// Lee la configuración del servidor desde el archivo XML
        /// </summary>
        public bool ReadConfigFileMallServer()
        {
            string path = Path.Combine(Utilities.AppPath, "MallServer.xml");

            bool error = false;

            if (File.Exists(path))
            {
                XmlReader reader = null;
                try
                {
                    reader = new XmlTextReader(new StreamReader(path));
                    reader.ReadStartElement("mallserver");
                    reader.ReadStartElement("ipServer");
                    ipServer = reader.ReadString();

                    if (String.IsNullOrEmpty(ipServer))
                    {
                        error = true;
                    }
                    reader.ReadEndElement();

                    reader.ReadStartElement("portServer");
                    portServer = reader.ReadContentAsInt();
                    reader.ReadEndElement();

                    reader.ReadStartElement("pingTime");
                    pingTime = reader.ReadContentAsInt();
                    reader.ReadEndElement();

                    reader.ReadEndElement();
                }
                catch (IOException)
                {
                    error = true;
                }
                catch (FormatException)
                {
                    error = true;
                }
                catch (XmlException)
                {
                    error = true;
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Close();
                    }
                }
            }
            else
            {
                error = true;
            }
            // Si hace falta configurar el servidor
            if (error)
            {
                MallConfigurationForm mallConfigurationForm = new MallConfigurationForm();
                mallConfigurationForm.Owner = mainMenu;
                mallConfigurationForm.ShowDialog();
                return(ReadConfigFileMallServer());
            }
            return(true);
        }