Ejemplo n.º 1
0
        public MainForm(string settingsFile)
        {
            InitializeComponent();
            this.FormTitle        = this.Text;
            this.initSettingsFile = settingsFile;

            numApplicationRevision.Minimum = 0;
            numApplicationRevision.Maximum = int.MaxValue;

            tsbNew.Click  += delegate(object sender, EventArgs e) { NewOptionsFile(); };
            tsbOpen.Click += delegate(object sender, EventArgs e) { LoadOptionsFile(); };
            tsbSave.Click += delegate(object sender, EventArgs e) { SaveOptionsFile(); };

            btnBrowse_ManifestKey.Click += new EventHandler(btnBrowseManifestKey_Click);
            btnBrowse_AssemblyOriginatorKeyFile.Click += new EventHandler(btnBrowse_AssemblyOriginatorKeyFile_Click);

            tsbPublish.Click += delegate(object sender, EventArgs e)
            {
                if (document == null)
                {
                    return;
                }
                SaveOptionsFile();

                BuildForm form = new BuildForm(document.FileName);
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                }
            };

            tsbExportToCSProject.Click += new EventHandler(tsbExportToCSProject_Click);
            txtExecuteFile.TextChanged += new EventHandler(txtExecuteFile_TextChanged);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string settingsFile = "";
            string options      = "";

            if (args.Length > 0)
            {
                settingsFile = args[0];
            }
            if (args.Length > 1)
            {
                options = args[1];
            }

            Form form = null;

            switch (options.Trim().ToLower())
            {
            case "/update":
                string fileName = System.IO.Path.Combine(Application.StartupPath, settingsFile);
                ClickOnceConfigFile document = new ClickOnceConfigFile(fileName);
                document.RefreshPublishFiles();
                //项目文件
                document.WriteXml(document.FileName);
                Console.WriteLine("/update 成功更新。");
                return;

            case "/build":
                form = new BuildForm(settingsFile);
                break;

            default:
                form = new MainForm(settingsFile);
                break;
            }
            Application.Run(form);
        }