Ejemplo n.º 1
0
        private void OpenFile()
        {
            OpenFileDialog openDialog = new OpenFileDialog();

            openDialog.CheckPathExists    = true;
            openDialog.AddExtension       = true;
            openDialog.AutoUpgradeEnabled = true;
            openDialog.InitialDirectory   = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyComputer);
            openDialog.DefaultExt         = ".beta";
            openDialog.Filter             = "BetaData Files (*.beta)|*.beta";
            openDialog.FilterIndex        = 0;
            openDialog.Multiselect        = false;

            DialogResult dr = openDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                this.BetaData = BetaData.Load(openDialog.FileName);
                this.BetaData.DependencyProducts.ListChanged += DependencyProducts_ListChanged;

                this._newBetaDataFile = false;
                this._hasChanges      = false;

                this.Cursor = Cursors.WaitCursor;
                this.LoadProducts();
                this.UpdateControls();
                this.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        public BetaDataEditorForm(BetaData beta, bool isEditor)
        {
            this.Cursor = Cursors.WaitCursor;

            this.StartPosition = FormStartPosition.CenterScreen;

            this.BetaData  = beta;
            this._isEditor = isEditor;

            this.InitializeComponent();

            if (this._isEditor)
            {
                this.BetaData.UpdateCheckout(this.BetaData.Path, this.BetaData.Url);
            }
            else
            {
                this._newBetaDataFile = true;
            }

            this.Init();

            this.Translate();

            this.Cursor = Cursors.Default;
        }
Ejemplo n.º 3
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            BetaData beta = value as BetaData;

            if (svc != null && beta != null)
            {
                using (BetaDataEditorForm form = new BetaDataEditorForm(beta, true))
                    form.ShowDialog();
            }

            return(beta);
        }
Ejemplo n.º 4
0
        public static BetaData Load(string path)
        {
            FileInfo fileinfo = new FileInfo(path);

            if (!fileinfo.Exists)
            {
                return(null);
            }

            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load(path);

            if (!xmlDocument.DocumentElement.Name.Equals("BetaData"))
            {
                return(null);
            }

            XmlElement   documentElement = xmlDocument.DocumentElement;
            XmlAttribute name            = documentElement.Attributes["Name"];

            BetaData beta = new BetaData();

            beta._created = true;
            beta._name    = name.Value;
            beta.Path     = path;

            foreach (XmlElement child in documentElement.ChildNodes)
            {
                if (child.Name.Equals("DependencyProducts"))
                {
                    beta.DependencyProducts = DependencyProducts.Load(child);
                }
            }

            return(beta);
        }