Esempio n. 1
0
        public MainController(params Form[] views)
        {
            foreach (var view in views)
            {
                if (view is UpdateForm)
                {
                    _updateForm = (UpdateForm)view;
                }
                else if (view is UpdateFormDepartment)
                {
                    _updateFormDepartments = (UpdateFormDepartment)view;
                }
                else if (view is EmployeeForm)
                {
                    _updateFormEmployee = (EmployeeForm)view;
                }
                else if (view is DepartmentEmployeeForm)
                {
                    _departmentEmployeeForm = (DepartmentEmployeeForm)view;
                }
                else if (view is MainForm)
                {
                    _mainForm = (MainForm)view;
                    _mainForm.GetDeleteButton.Click += Delete;
                    _mainForm.GetInsertButton.Click += Insert;

                    _mainForm.GetGrid.RowHeaderMouseDoubleClick += Update;

                    //_mainForm.Load += Read;
                    _mainForm.NetWorthButton.Click          += CalculateNetWorth;
                    _mainForm.GetCombo.SelectedIndexChanged += Read;
                    _mainForm.GetCombo.SelectedIndexChanged += SetTableName;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Updates a specific feature.
        /// </summary>
        /// <param name="update">The feature selected for update.</param>
        /// <returns>True if feature accepted for update. False if an update is already in progress.</returns>
        internal bool Run(Feature update)
        {
            // Return if we're currently updating something, or we've
            // hit a problem during rollforward.
            if (m_Cmd != null || m_Problem != null)
            {
                return(false);
            }

            // If we prevously had something selected for update,
            // undo any drawing that we did for it.
            ErasePainting();

            // Remember the specified feature.
            m_SelectedFeature = update;

            // If the info dialog has not already been displayed, display it now.
            if (m_Info == null)
            {
                m_Info = new UpdateForm(this);
                m_Info.Show();
            }

            // Get the info window to display stuff about the selected feature.
            m_Info.Display(m_SelectedFeature);

            // Leave keyboard focus with the info dialog.
            m_Info.Focus();

            // Draw stuff.
            Draw();
            ActiveDisplay.PaintNow();
            return(true);
        }
        /// <summary>
        /// This is the function which is called in "receivingThread"
        /// </summary>
        private void DoReceive()
        {
            Byte[] buffer = new Byte[1024];
            while (IsRuning)
            {
                while (IsReceiving)
                {
                    try
                    {
                        if (base.BytesToRead > 0)
                        {
                            Int32 length = base.Read(buffer, 0, buffer.Length);
                            Array.Resize(ref buffer, length);
                            UpdateForm u = new UpdateForm(form.UpdateText);
                            form.Invoke(u, new Object[] { buffer });
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Receving thread error: " + ex.Message, "Warning!");
                        IsReceiving = false;
                    }

                    Thread.Sleep(50);
                }
                while (!IsReceiving)
                {
                    Thread.Sleep(10);
                }
            }
        }
Esempio n. 4
0
        void updater_CheckForUpdateComplete(Updater sender, CheckForUpdateCompleteEventArgs args)
        {
            // make sure any exisiting form is closed first (we dont want to re-use it directly because it might get
            // disposed out from under us).
            if (this.updateForm != null)
            {
                try
                {
                    this.updateForm.Close();
                    this.updateForm.Dispose();
                    this.updateForm = null;
                }
                finally
                {
                    // this is just in case the form was closed but not disposed of properly
                }
            }

            // if there is an update available or if the user asked specifically, show the update form
            if (args.UpdateAvailable || args.UserInitiated)
            {
                this.updateForm = new UpdateForm(this.updater);
                this.updateForm.LaunchUpdater(args.Manifest, args.UpdateAvailable, args.ErrorArgs);
            }
            this.autoUpdateTimer.Start();
        }
Esempio n. 5
0
 public DownloaderSubsystem(
     SuggestImageDownloaderConfig config,
     UpdateForm updateForm)
 {
     _config     = config;
     _updateForm = updateForm;
 }
Esempio n. 6
0
        private void uxCheckForUpdateToolStripStatusLabel_Click(object sender, EventArgs e)
        {
            UpdateForm form = new UpdateForm();
            form.StartPosition = FormStartPosition.CenterParent;

            form.ShowDialog();
        }
Esempio n. 7
0
        public BaseForm getForm(typeForm type, AbstractController controller, string tableName)
        {
            BaseForm res = null;

            switch (type)
            {
            case typeForm.ADD:
                res = new AddForm(controller, tableName);
                return(res);

            case typeForm.READ:
                res = new ReadForm(controller, tableName);
                return(res);

            case typeForm.UPDATE:
                res = new UpdateForm(controller, tableName);
                return(res);

            case typeForm.DELETE:
                res = new DeleteForm(controller, tableName);
                return(res);

            default:
                return(res);
            }
        }
Esempio n. 8
0
        public BaseForm getForm(typeForm type, string cnnString, string tableName, BaseForm rootForm)
        {
            BaseForm res = null;

            switch (type)
            {
            case typeForm.ADD:
                res = new AddForm(cnnString, tableName);
                return(res);

            case typeForm.READ:
                res = new ReadForm(cnnString, tableName);
                return(res);

            case typeForm.UPDATE:
                res = new UpdateForm(cnnString, tableName);
                return(res);

            case typeForm.DELETE:
                res = new DeleteForm(cnnString, tableName);
                return(res);

            case typeForm.HASFORMS:
                res = new FormHasForms(cnnString, tableName, rootForm);
                return(res);

            default:
                return(res);
            }
        }
Esempio n. 9
0
        //public Form createForm()
        //{
        //    throw new NotImplementedException();
        //}

        //public Form createForm(IConnector dbConn, string dbName, string tabName)
        //{
        //    throw new NotImplementedException();
        //}

        public Form createForm(IConnector dbConn, string dbName, string tabName, string windowsName, object[] obj)
        {
            BaseForm frm = new UpdateForm(dbConn, dbName, tabName, windowsName, obj);

            frm.ShowDialog();
            return(frm);
        }
Esempio n. 10
0
        public override async Task <Project> UpdateAsync(int id, Project resource)
        {
            //If changing organization, validate the change
            var updateForm = new UpdateForm(UserRepository,
                                            GroupRepository,
                                            CurrentUserContext,
                                            OrganizationRepository,
                                            UserRolesRepository,
                                            OrganizationContext,
                                            ProjectRepository);

            if (!updateForm.IsValid(id, resource))
            {
                throw new JsonApiException(updateForm.Errors);
            }

            var project = await base.UpdateAsync(id, resource);

            // If the owner is changing, call the build engine to update the project iam permissions
            if (resource.OwnerId != 0)
            {
                HangfireClient.Enqueue <WorkflowProjectService>(service => service.ReassignUserTasks(project.Id));
            }
            return(project);
        }
Esempio n. 11
0
        // open device; mode is selected depending on state of NativeData
        // => see OpenNative() and OpenPAnsiChar()
        private bool OpenIRCom()
        {
            UpdateForm update = new UpdateForm(MainForm.UpdateMessageBox);

            try
            {
                if (NativeMode == true)
                {
                    Native = new dlgtNative(MyCallBackNative);
                    return(InitNative(Native));
                }
                else
                {
                    PAnsiChar = new dlgtPAnsiChar(MyCallBackPAnsiChar);
                    return(InitPAnsiChar(PAnsiChar));
                }
            }
            catch (DllNotFoundException)
            {
                MainForm.Invoke(update, true,
                                String.Format("ERROR: unable to find DLL '{0}'!\r\n", USB_IRRR_DllName));
                return(false);
            }
            catch (SEHException)
            {
                MainForm.Invoke(update, true,
                                String.Format("ERROR: SEHException occured!\r\nRestart the application to change the mode or use a DLL version above 1.0.0.10."));
                return(false);
            }
        }
Esempio n. 12
0
        // callback function for PAnsiChar mode
        private void MyCallBackPAnsiChar(string Protocol, string Address, string Command, string Flags)
        {
            UpdateForm update = new UpdateForm(MainForm.UpdateMessageBox);

            MainForm.Invoke(update, false,
                            String.Format("Protocol={0}, Address={1}, Command={2}, Flags={3}\r\n",
                                          Protocol, Address, Command, Flags));
        }
Esempio n. 13
0
        Guid m_guidDesktopGroupId = Guid.Empty;//当前桌面组

        public DesktopPanel()
        {
            UpdateForm frmUp = new UpdateForm();

            frmUp.ShowDialog();

            InitializeComponent();
        }
Esempio n. 14
0
        public MainForm()
        {
            // Automatic updates
            UpdateForm updateForm = new UpdateForm();
            updateForm.Show();

            InitializeComponent();
        }
Esempio n. 15
0
        public async Task <IActionResult> PutAsync([FromForm] UpdateForm updateForm)
        {
            var form = mapper.Map <Form>(updateForm);

            var validation = await formService.UpdateAsync(form);

            return(CreateObjectResult(validation));
        }
Esempio n. 16
0
 private void removeTeachertButton_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem t in teachersListView.CheckedItems)
     {
         _controller.RemoveTeacher(t.SubItems[1].Text);
     }
     UpdateForm?.Invoke(this, e);
 }
Esempio n. 17
0
        /**
         * 右键修改按钮点击事件
         * */
        private void BtnRightUpdateClick(Object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem   = (ToolStripMenuItem)sender;
            UpdateForm        updateForm = new UpdateForm();

            updateForm.setMainForm(this);
            updateForm.setSection((String)menuItem.Tag);
            updateForm.ShowDialog();
        }
Esempio n. 18
0
        // callback function for Native mode
        private void MyCallBackNative(IrmpData ir_code)
        {
            UpdateForm update = new UpdateForm(MainForm.UpdateMessageBox);

            MainForm.Invoke(update, false,
                            String.Format("Protocol=0x{0}, Address=0x{1}, Command=0x{2}, Flags=0x{3}\r\n",
                                          ir_code.Protocol.ToString("X2"), ir_code.Address.ToString("X4"),
                                          ir_code.Command.ToString("X4"), ir_code.Flags.ToString("X2")));
        }
Esempio n. 19
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     using (var updateForm = new UpdateForm())
     {
         Application.Run(updateForm);
     }
 }
 public static void Open(string ver, bool api)
 {
     UpdateForm t = new UpdateForm();
     if(!api)
         t.label2.Text = string.Format("Version {0} for MCModUpdater is now available.", ver);
     else
         t.label2.Text = string.Format("Version {0} for MCModUpdater API is now available.", ver);
     t.ShowDialog();
 }
Esempio n. 21
0
        private void 检测更新ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UpdateForm ud = new UpdateForm();

            ud.MainAppFileName = Application.ExecutablePath;
            ud.VersionFileUrl  = @"https://github.com/450640526/HtmExplorer/blob/master/HtmExplorer_Release/version.txt?raw=true";
            ud.UpdateFileUrl   = @"https://github.com/450640526/HtmExplorer/blob/master/HtmExplorer_Release/HtmExplorer.rar?raw=true";
            ud.Show();
        }
Esempio n. 22
0
        void ModifySubscribe(object sender, EventArgs e)
        {
            UpdateForm updateForm = new UpdateForm();

            updateForm.StartPosition = FormStartPosition.CenterParent;
            if (updateForm.ShowDialog() == DialogResult.OK)
            {
                RebindToDataGrid();
            }
        }
        public UpdateOptionsControl()
        {
            InitializeComponent();

            // Create the update form
            uf = new UpdateForm();

            // Reset all the elements to their saved state
            resetState();
        }
Esempio n. 24
0
        public UpdateOptionsControl()
        {
            InitializeComponent();

            // Create the update form
            uf = new UpdateForm();

            // Reset all the elements to their saved state
            resetState();
        }
Esempio n. 25
0
        private void teachersListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (teachersListView.SelectedItems.Count == 0)
            {
                return;
            }
            var item = teachersListView.SelectedItems[0];

            _controller.SelectTeacher(item.SubItems[1].Text);
            UpdateForm?.Invoke(this, e);
        }
Esempio n. 26
0
		private static SplashForm splash;// = new SplashForm();

		internal static void Launch()
		{
			Application.CurrentCulture = CultureInfo.InvariantCulture;
            Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
		    splash = new SplashForm();
			splash.Show();
			Timer timer = new Timer();
			//Configure this timer to restart each second ( 1000 millis)
			timer.Interval = 1000;
			timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
			timer.Start();
			//splash.Refresh();
			
			//Application.DoEvents();
			Application.DoEvents();
			MainModule.Initialize("data");
			splash.SetLoadProgress(50);
			splash.Refresh();
			Application.DoEvents();

			UpdaterHelper.UpdateInfo info;
			info = UpdaterHelper.CheckFromUpdates();
			Application.DoEvents();
			if (info.UpdateAvailable)
			{
				UpdateForm updateForm;
				updateForm = new UpdateForm(info);
				updateForm.ShowDialog();
				Application.DoEvents();
			}

			splash.SetLoadProgress(60);
			splash.Refresh();
			Application.DoEvents();
			IconsManager.Initialize();
			Application.DoEvents();
			MainForm main = new MainForm();
            //if (runSingleInstance)
            //{
            //    main.HandleCreated += new EventHandler(main_HandleCreated);
            //}
			GC.Collect();
            timer.Stop();
            timer.Close();
			splash.SetLoadProgress(100);
			splash.Refresh();
			Application.DoEvents();
			splash.Close();
			splash = null;
			Application.DoEvents();
            
			Application.Run(main);
		} //Launch
Esempio n. 27
0
 public static UpdateForm GetInstance(string version)
 {
     if (form == null)
     {
         lock (synLock)
         {
             if (form == null) form = new UpdateForm(version);
         }
     }
     return form;
 }
Esempio n. 28
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            using (var context = new Controller.MyDbContext())
            {
                try
                {
                    context.Database.Connection.Open();
                }
                catch (Npgsql.PostgresException ex)
                {
                    MessageBox.Show($"{ex.MessageText}\n" +
                                    $" check the connection string!",
                                    "Error!",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    Environment.Exit(1);
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Invalid ConnectionString name.",
                                    "Error!",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    Environment.Exit(1);
                }
                finally
                {
                    context.Database.Connection.Close();
                }
            }

            UpdateForm             updateFormProject      = new UpdateForm();
            EmployeeForm           updateFormEmployee     = new EmployeeForm();
            UpdateFormDepartment   updateFormDepartment   = new UpdateFormDepartment();
            DepartmentEmployeeForm departmentEmployeeForm = new DepartmentEmployeeForm();

            LoginForm loginForm = new LoginForm();
            MainForm  mainForm  = new MainForm();



            MainController mainController = new MainController(mainForm,
                                                               updateFormProject,
                                                               updateFormDepartment,
                                                               updateFormEmployee,
                                                               departmentEmployeeForm);

            LoginController loginController = new LoginController(loginForm, mainForm);

            Application.Run(loginForm);
        }
Esempio n. 29
0
        private void buttonInit_Click(object sender, EventArgs e)
        {
            if (_controller.TypeDepartament == TypeDepartment.StorageDepartment)
            {
                _controller.InitializeRobot();
            }

            _controller.InitializeProductions();
            _controller.InitializePiples();
            UpdateForm?.Invoke(this, e);
        }
Esempio n. 30
0
 public static SuperHeroClient ToClient(this UpdateForm entity)
 {
     return(new SuperHeroClient()
     {
         Id = entity.Id,
         Name = entity.Name,
         Charism = entity.Charism,
         Intelligence = entity.Intelligence,
         Strenght = entity.Strenght,
         Stamina = entity.Stamina,
     });
 }
Esempio n. 31
0
 private void updateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     UpdateForm fm = new UpdateForm();
     try
     {
         fm.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
     }
 }
Esempio n. 32
0
        private void newDepartmentButton_Click(object sender, EventArgs e)
        {
            var newDepartmentController = new NewDepartmentFormController(_controller.Departments, _controller.CityCode);
            var newDepartmentForm       = new NewDepartmentForm(newDepartmentController);

            if (newDepartmentForm.ShowDialog() == DialogResult.OK)
            {
                var newDepartment = newDepartmentController.Department;
                _controller.AddDepartment(newDepartment);
            }
            UpdateForm?.Invoke(this, e);
        }
Esempio n. 33
0
        private void subjectsListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (subjectsListView.SelectedItems.Count == 0)
            {
                return;
            }
            var item = subjectsListView.SelectedItems[0];
            var s    = _controller.SelectSubject(item.SubItems[1].Text);

            ShowStudents(s.NameSubject);
            UpdateForm?.Invoke(this, e);
        }
Esempio n. 34
0
 private void updateButton_Click(object sender, EventArgs e)
 {
     try
     {
         UpdateForm upForm = new UpdateForm(resultBox.SelectedItems[0].Text, dbdirec, dbfname, search);
         upForm.ShowDialog(this);
     }
     catch (Exception)
     {
         //
     }
 }
Esempio n. 35
0
 public void ShowUpdateForm()
 {
     if (Global.MainForm.InvokeRequired)
     {
         Global.MainForm.Invoke(new ShowUpdateFormHandler(ShowUpdateForm));
     }
     else
     {
         UpdateForm form = new UpdateForm(this);
         form.ShowDialog();
     }
 }
Esempio n. 36
0
 public override async Task<Group> UpdateAsync(int id, Group resource)
 {
     var updateForm = new UpdateForm(UserRepository,
                                      GroupRepository,
                                      OrganizationContext,
                                      UserRolesRepository,
                                      CurrentUserContext);
     if (!updateForm.IsValid(id, resource))
     {
         throw new JsonApiException(updateForm.Errors);
     }
     return await base.UpdateAsync(id, resource);
 }
Esempio n. 37
0
        private void ChangeButton_Click(object sender, EventArgs e)//Change swimmers
        {
            UpdateForm changetest = new UpdateForm();

            changetest.SurnameTextBoxUpdate.Text    = DataGridViewMain.CurrentRow.Cells[1].Value.ToString();
            changetest.NameTextBoxUpdate.Text       = DataGridViewMain.CurrentRow.Cells[2].Value.ToString();
            changetest.FamilyNameTextBoxUpdate.Text = DataGridViewMain.CurrentRow.Cells[3].Value.ToString();
            string DateOfBithText = DataGridViewMain.CurrentRow.Cells[4].Value.ToString(); DateOfBithText = DateOfBithText.Substring(0, 10);

            changetest.DateOfBithTextBoxUpdate.Text = DateOfBithText;
            changetest.CategoryTextBoxUpdate.Text   = DataGridViewMain.CurrentRow.Cells[5].Value.ToString();
            changetest.ShowDialog();
            LoadData();
        }
Esempio n. 38
0
        private void btnUpdateCustomer_Click(object sender, EventArgs e)
        {
            //Εδώ θέτω στην νέα Update Form ποιά θα είναι τα στοιχεία στα Κελιά των αποθηκευμένων.
            UpdateForm UpdateForm = new UpdateForm();
            DataGridViewRow row = dataGridView1.CurrentCell.OwningRow;
            int ID = Convert.ToInt32(row.Cells[0].Value.ToString());
            string FirstName = row.Cells[1].Value.ToString();
            string LastName = row.Cells[2].Value.ToString();
            string Telephone = row.Cells[3].Value.ToString();
            string Address = row.Cells[4].Value.ToString();

            //Method η αποία τοποθετεί τα παραπάνω στοιχεία στα κουτιά των αποθηκευμένων.(η μέθοδος έχει δημιουργηθεί στην UpdateForm)
            UpdateForm.SetExistCells(ID, FirstName, LastName, Telephone, Address);
            UpdateForm.Show();
        }
Esempio n. 39
0
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                MessageBox.Show("Updater was launched without manifest and executable arguments.", "Updater Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // TODO : better error messages
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var f = new UpdateForm();
            f.Manifest = args[0];
            f.Executible = args[1];
            Application.Run(f);
        }
Esempio n. 40
0
        public ViewControl(string viewName, int maxHeight)
        {
            InitializeComponent();
            this.gridView.Name = this.viewName = viewName;
            this.Edit.Text = "...";
            this.Edit.Width = 30;
            this.Edit.UseColumnTextForButtonValue = true;
            view = Program.Context.ViewToGridManager.bindToView(gridView);
            addForm = FormFactory.createAddForm(viewName, this);
            addForm.StartPosition = FormStartPosition.CenterParent;
            updateForm = FormFactory.createUpdateForm(viewName, this);
            updateForm.StartPosition = FormStartPosition.CenterParent;
            this.gridView.Height = maxHeight - 50;
            if (view.Insertable == false) this.Add.Visible = false;
            if (view.Updateable == false) this.Edit.Visible = false;
//            this.
        }
Esempio n. 41
0
        private void ShowUpdateDialog(Version appVersion, Version newVersion, XDocument doc)
        {
            if (InvokeRequired)
            {
                Invoke(new Action<Version, Version, XDocument>(ShowUpdateDialog), appVersion, newVersion, doc);
                return;
            }

            using (UpdateForm f = new UpdateForm())
            {
                f.Text = string.Format(f.Text, Application.ProductName, appVersion);
                f.MoreInfoLink = (string)doc.Root.Element("info");
                f.Info = string.Format(f.Info, newVersion, (DateTime)doc.Root.Element("date"));
                if (f.ShowDialog(this) == DialogResult.OK)
                {
                    Updater.LaunchUpdater(doc);
                    this.Close();
                }
            }
        }
Esempio n. 42
0
        public AboutBox()
        {
            InitializeComponent();

            //  Initialize the AboutBox to display the product information from the assembly information.
            //  Change assembly information settings for your application through either:
            //  - Project->Properties->Application->Assembly Information
            //  - AssemblyInfo.cs
            this.Text = String.Format("About {0}", AssemblyTitle);
            this.labelProductName.Text = AssemblyProduct;
            this.textBoxVersion.Text = String.Format("Version {0}", AssemblyVersion);
            this.labelCopyright.Text = AssemblyCopyright;
            this.labelCompanyName.Text = AssemblyCompany;
            this.textBoxDescription.Text = AssemblyDescription;

            // Create the update form
            uf = new UpdateForm();

            // Reset the font
            resetDialogFont();
        }
 private void updateButton_Click(object sender, EventArgs e)
 {
     using (var u = new UpdateForm())
     {
         u.Init(onlineVersion);
         u.ShowDialog();
     }
 }
Esempio n. 44
0
 private void ShowUpdateWindow()
 {
     this.BeginInvoke((Action)(() =>
     {
         UpdateForm updateForm = new UpdateForm();
         updateForm.ShowDialog(this);
     }));
 }
Esempio n. 45
0
 private void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
 {
     try
     {
         Stream data = e.Result;
         StreamReader httpReader = new StreamReader(data);
         string xml = httpReader.ReadToEnd();
         data.Close();
         httpReader.Close();
         XmlSerializer xmlReader = new XmlSerializer(typeof(VersionInfo));
         StringReader stringReader = new StringReader(xml);
         VersionInfo versionInfo = (VersionInfo)xmlReader.Deserialize(stringReader);
         MainModule = (UpdateInfo)Xml.CheckIfNull(typeof(UpdateInfo), versionInfo.MainModule, MainModule);
         stringReader.Close();
     }
     catch (Exception ex)
     {
         if (showMsg)
             System.Windows.Forms.MessageBox.Show("Unable to connect to server:\n\n" + ex.Message, "Update", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         ((WebClient)sender).Dispose();
     }
     // Check modules for new versions
     List<Modules> newUpdates = new List<Modules>();
     // Check MainModule version
     if (new Version(MainModule.LatestVersion).CompareTo(MainModule.CurrentVersion) > 0 &&
         MainModule.Urls.Count > 0)
         newUpdates.Add(Modules.MainModule);
     // If any module has an update
     if (newUpdates.Count > 0)
     {
         if (showMsg)
         {
             UpdateForm form = new UpdateForm(this);
             DialogResult result = form.ShowDialog();
             if (result == DialogResult.Yes)
                 Update();
         }
         if (UpdateAvailableEvent != null)
             UpdateAvailableEvent(this, new UpdateEventArgs(newUpdates));
     }
     else
     {
         if (showMsg)
             MessageBox.Show("No update available. You already have the latest version (" + MainModule.CurrentVersion.ToString() + ").", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 46
0
 private void toolStripDropDownButton1_Click(object sender, EventArgs e)
 {
     var form = new UpdateForm();
     form.Owner = this;
     DialogResult dr = form.ShowDialog();
     if (dr == DialogResult.OK)
     {
         Async.Queue(Kernel.Instance.GetString("CheckUpdatesAsync"), () =>
         {
             Updater.DownloadUpdateFile();
         }, SetUpdate);
     }
 }
Esempio n. 47
0
        private static void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            Assembly mainAssembly = Assembly.GetEntryAssembly();
            var companyAttribute =
                (AssemblyCompanyAttribute) GetAttribute(mainAssembly, typeof (AssemblyCompanyAttribute));
            var titleAttribute = (AssemblyTitleAttribute) GetAttribute(mainAssembly, typeof (AssemblyTitleAttribute));
            AppTitle = titleAttribute != null ? titleAttribute.Title : mainAssembly.GetName().Name;
            string appCompany = companyAttribute != null ? companyAttribute.Company : "";

            RegistryLocation = !string.IsNullOrEmpty(appCompany)
                ? string.Format(@"Software\{0}\{1}\AutoUpdater", appCompany, AppTitle)
                : string.Format(@"Software\{0}\AutoUpdater", AppTitle);

            RegistryKey updateKey = Registry.CurrentUser.OpenSubKey(RegistryLocation);

            if (updateKey != null)
            {
                object remindLaterTime = updateKey.GetValue("remindlater");

                if (remindLaterTime != null)
                {
                    DateTime remindLater = Convert.ToDateTime(remindLaterTime.ToString(),
                        CultureInfo.CreateSpecificCulture("en-US"));

                    int compareResult = DateTime.Compare(DateTime.Now, remindLater);

                    if (compareResult < 0)
                    {
                        var updateForm = new UpdateForm(true);
                        updateForm.SetTimer(remindLater);
                        return;
                    }
                }
            }

            InstalledVersion = mainAssembly.GetName().Version;

            WebRequest webRequest = WebRequest.Create(AppCastURL);
            webRequest.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);

            WebResponse webResponse;

            try
            {
                webResponse = webRequest.GetResponse();
            }
            catch (Exception)
            {
                if (CheckForUpdateEvent != null)
                {
                    CheckForUpdateEvent(null);
                }
                return;
            }

            Stream appCastStream = webResponse.GetResponseStream();

            var receivedAppCastDocument = new XmlDocument();

            if (appCastStream != null)
            {
                receivedAppCastDocument.Load(appCastStream);
            }
            else
            {
                if (CheckForUpdateEvent != null)
                {
                    CheckForUpdateEvent(null);
                }
                return;
            }

            XmlNodeList appCastItems = receivedAppCastDocument.SelectNodes("item");

            if (appCastItems != null)
                foreach (XmlNode item in appCastItems)
                {
                    XmlNode appCastVersion = item.SelectSingleNode("version");
                    if (appCastVersion != null)
                    {
                        String appVersion = appCastVersion.InnerText;
                        CurrentVersion = new Version(appVersion);
                    }
                    else
                        continue;

                    XmlNode appCastTitle = item.SelectSingleNode("title");

                    DialogTitle = appCastTitle != null ? appCastTitle.InnerText : "";

                    XmlNode appCastChangeLog = item.SelectSingleNode("changelog");

                    ChangeLogURL = appCastChangeLog != null ? appCastChangeLog.InnerText : "";

                    XmlNode appCastUrl = item.SelectSingleNode("url");

                    DownloadURL = appCastUrl != null ? appCastUrl.InnerText : "";

                    if (IntPtr.Size.Equals(8))
                    {
                        XmlNode appCastUrl64 = item.SelectSingleNode("url64");

                        var downloadURL64 = appCastUrl64 != null ? appCastUrl64.InnerText : "";

                        if(!string.IsNullOrEmpty(downloadURL64))
                        {
                            DownloadURL = downloadURL64;
                        }
                    }
                }

            if (updateKey != null)
            {
                object skip = updateKey.GetValue("skip");
                object applicationVersion = updateKey.GetValue("version");
                if (skip != null && applicationVersion != null)
                {
                    string skipValue = skip.ToString();
                    var skipVersion = new Version(applicationVersion.ToString());
                    if (skipValue.Equals("1") && CurrentVersion <= skipVersion)
                        return;
                    if (CurrentVersion > skipVersion)
                    {
                        RegistryKey updateKeyWrite = Registry.CurrentUser.CreateSubKey(RegistryLocation);
                        if (updateKeyWrite != null)
                        {
                            updateKeyWrite.SetValue("version", CurrentVersion.ToString());
                            updateKeyWrite.SetValue("skip", 0);
                        }
                    }
                }
                updateKey.Close();
            }

            if (CurrentVersion == null)
                return;

            var args = new UpdateInfoEventArgs
            {
                DownloadURL = DownloadURL,
                ChangelogURL = ChangeLogURL,
                CurrentVersion = CurrentVersion,
                InstalledVersion = InstalledVersion,
                IsUpdateAvailable = false,
            };

            if (CurrentVersion > InstalledVersion)
            {
                args.IsUpdateAvailable = true;
                if (CheckForUpdateEvent == null)
                {
                    var thread = new Thread(ShowUI);
                    thread.CurrentCulture = thread.CurrentUICulture = CurrentCulture ?? Application.CurrentCulture;
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();
                }
            }

            if (CheckForUpdateEvent != null)
            {
                CheckForUpdateEvent(args);
            }
        }
Esempio n. 48
0
 //检查更新
 private void CheckNewVersion_Tick(object sender, EventArgs e)
 {
     try
     {
         _checkUpdate = new CheckUpdate();
         if (_checkUpdate.IsConnectedInternet())
         {
             if (_checkUpdate.Download())
             {
                 if (_checkUpdate.HasNewVersion())
                 {
                     form_Update = UpdateForm.GetInstance(_checkUpdate.NewVersion);
                     form_Update.CloseHandlor += new UpdateForm.CloseHandler(CloseDeskHelper);
                     form_Update.ShowForm();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         log.WriteLog(ex.ToString());
     }
     finally
     {
         updateTimer.Enabled = false;
     }
 }
Esempio n. 49
0
 private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (UpdateForm form = new UpdateForm())
        {
     form.ShowDialog();
        }
 }
Esempio n. 50
0
 private void NewVersionReleased(VERSION v)
 {
     UpdateForm uf = new UpdateForm(v);
     uf.ShowDialog();
 }
Esempio n. 51
0
        private static void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            int compareResult;
            AutoUpdateEventArgs args = new AutoUpdateEventArgs();

            Thread.CurrentThread.CurrentUICulture = CurrentCulture;
            var mainAssembly = Assembly.GetEntryAssembly();
            var companyAttribute = (AssemblyCompanyAttribute)GetAttribute(mainAssembly, typeof(AssemblyCompanyAttribute));
            var titleAttribute = (AssemblyTitleAttribute)GetAttribute(mainAssembly, typeof(AssemblyTitleAttribute));
            AppTitle = titleAttribute != null ? titleAttribute.Title : mainAssembly.GetName().Name;
            var appCompany = companyAttribute != null ? companyAttribute.Company : "";
            int days = (int)e.Argument;

            RegistryLocation = string.Format(@"Software\{0}\{1}\AutoUpdater", appCompany, AppTitle);

            RegistryKey updateKey = Registry.CurrentUser.OpenSubKey(RegistryLocation, true) ??
                                    Registry.CurrentUser.CreateSubKey(RegistryLocation);

            object remindLaterTime = updateKey.GetValue("remindlater");
            if (remindLaterTime == null && days > 0)
            {
                string lastcheck = updateKey.GetValue("lastcheck", "").ToString();
                if (!String.IsNullOrEmpty(lastcheck))
                {
                    try
                    {
                        DateTime lastcheckDate = Convert.ToDateTime(lastcheck, CultureInfo.InvariantCulture);
                        compareResult = DateTime.Compare(DateTime.Now, lastcheckDate.AddDays(days));

                        if (compareResult < 0)
                        {
                            args.Status = AutoUpdateEventArgs.StatusCodes.delayed;
                            args.Text = string.Format(Strings.sLastCheck, lastcheckDate.ToString("D", CurrentCulture));
                            OnUpdateStatus(args);
                            return;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            if (remindLaterTime != null && days > 0)
            {
                try
                {
                    DateTime remindLater = Convert.ToDateTime(remindLaterTime.ToString(), CultureInfo.InvariantCulture);

                    compareResult = DateTime.Compare(DateTime.Now, remindLater);

                    if (compareResult < 0)
                    {
                        var updateForm = new UpdateForm(true);
                        updateForm.SetTimer(remindLater);
                        return;
                    }
                }
                catch (Exception)
                {
                }
            }

            if (remindLaterTime != null)
                updateKey.DeleteValue("remindlater");

            InstalledVersion = mainAssembly.GetName().Version;

            args.Status = AutoUpdateEventArgs.StatusCodes.checking;
            args.Text = Strings.sCheckingForUpdates;
            OnUpdateStatus(args);
            WebRequest webRequest = WebRequest.Create(AppCastURL);
            webRequest.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);

            WebResponse webResponse;

            try
            {
                webResponse = webRequest.GetResponse();
            }
            catch (Exception ex)
            {
                args.Status = AutoUpdateEventArgs.StatusCodes.error;
                args.Text = ex.Message;
                OnUpdateStatus(args);
                return;
            }

            Stream appCastStream = webResponse.GetResponseStream();

            var receivedAppCastDocument = new XmlDocument();

            if (appCastStream != null) receivedAppCastDocument.Load(appCastStream);
            else return;

            XmlNodeList appCastItems = receivedAppCastDocument.SelectNodes("channel/item");

            if (appCastItems != null)
            {
                foreach (XmlNode item in appCastItems)
                {
                    XmlNode appCastVersion = item.SelectSingleNode("version");
                    if (appCastVersion != null)
                    {
                        String appVersion = appCastVersion.InnerText;
                        var version = new Version(appVersion);
                        if (version <= InstalledVersion)
                            continue;
                        CurrentVersion = version;
                    }
                    else
                        continue;

                    XmlNode appCastTitle = item.SelectSingleNode("title");

                    DialogTitle = appCastTitle != null ? appCastTitle.InnerText : "";

                    XmlNode appCastChangeLog = item.SelectSingleNode("changelog");

                    ChangeLogURL = appCastChangeLog != null ? appCastChangeLog.InnerText : "";

                    XmlNode appCastUrl = item.SelectSingleNode("url");

                    DownloadURL = appCastUrl != null ? appCastUrl.InnerText : "";
                }
            }

            object skip = updateKey.GetValue("skip");
            object applicationVersion = updateKey.GetValue("version");
            if (skip != null && applicationVersion != null)
            {
                string skipValue = skip.ToString();
                var skipVersion = new Version(applicationVersion.ToString());
                if (skipValue.Equals("1") && CurrentVersion <= skipVersion)
                {
                    args.Status = AutoUpdateEventArgs.StatusCodes.noUpdateAvailable;
                    args.Text = Strings.sSkipping;
                    OnUpdateStatus(args);
                    return;
                }
                if (CurrentVersion > skipVersion)
                {
                    RegistryKey updateKeyWrite = Registry.CurrentUser.CreateSubKey(RegistryLocation);
                    if (updateKeyWrite != null)
                    {
                        updateKeyWrite.SetValue("version", CurrentVersion.ToString());
                        updateKeyWrite.SetValue("skip", 0);
                    }
                }
            }

            updateKey.SetValue("lastcheck", DateTime.Now.ToString(CultureInfo.InvariantCulture));
            updateKey.Close();
            RunBrowserThread(versionURL);

            #if DEBUG
            if (days == -1)
            {
                args.Status = AutoUpdateEventArgs.StatusCodes.updateAvailable;
                args.Text = Strings.sUpdateAvailable;
                OnUpdateStatus(args);

                var thread = new Thread(ShowUI);
                thread.CurrentCulture = thread.CurrentUICulture = CurrentCulture ?? Application.CurrentCulture;
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            #endif

            if (CurrentVersion == null)
            {
                args.Status = AutoUpdateEventArgs.StatusCodes.noUpdateAvailable;
                args.Text = Strings.sLatestVersion;
                OnUpdateStatus(args);
                return;
            }

            if (CurrentVersion <= InstalledVersion) return;
            args.Status = AutoUpdateEventArgs.StatusCodes.updateAvailable;
            args.Text = Strings.sUpdateAvailable;
            OnUpdateStatus(args);

            if (days == 0)
            {
                var thread = new Thread(ShowUI);
                thread.CurrentCulture = thread.CurrentUICulture = CurrentCulture ?? Application.CurrentCulture;
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
        }
Esempio n. 52
0
 public void UpdateDB(bool isDownload)
 {
     if (isDownload)
     {
         btnUpdate.Enabled = false;
         UpdateForm upForm = new UpdateForm(myCmdMgr.Config.updateUrl);
         this.Enabled = false;
         upForm.ShowDialog();
         this.Enabled = true;
         
     }
     string fileName = myCmdMgr.Config.usingDB;
     string content = WinAptLib.GetAppInfoContent(fileName);
     if (content == "")
         return;
     myCmdMgr.UpdateAppDB(content);
     updateLvApp();
 }
Esempio n. 53
0
 private void UpdateClick(object sender, EventArgs e)
 {
     if (_updateForm == null)
         _updateForm = new UpdateForm();
     _updateForm.ShowDialog();
 }
Esempio n. 54
0
        internal static void Launch()
        {
            Application.CurrentCulture = CultureInfo.InvariantCulture;
            Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            splash = new SplashForm();
            splash.Show();
            Timer timer = new Timer();
            //Configure this timer to restart each second ( 1000 millis)
            timer.Interval = 1000;
            timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            timer.Start();
            //splash.Refresh();

            //Application.DoEvents();
            Application.DoEvents();
            MainModule.Initialize("data");
            splash.SetLoadProgress(50);
            splash.Refresh();
            Application.DoEvents();

            UpdaterHelper.UpdateInfo info;
            info = UpdaterHelper.CheckFromUpdates();
            Application.DoEvents();
            if (info.UpdateAvailable)
            {
                UpdateForm updateForm;
                updateForm = new UpdateForm(info);
                updateForm.ShowDialog();
                Application.DoEvents();
            }

            splash.SetLoadProgress(60);
            splash.Refresh();
            Application.DoEvents();
            IconsManager.Initialize();
            Application.DoEvents();
            MainForm main = new MainForm();
            //if (runSingleInstance)
            //{
            //    main.HandleCreated += new EventHandler(main_HandleCreated);
            //}
            GC.Collect();
            timer.Stop();
            timer.Close();
            splash.SetLoadProgress(100);
            splash.Refresh();
            Application.DoEvents();
            splash.Close();
            splash = null;
            Application.DoEvents();

            Application.Run(main);
        }
Esempio n. 55
0
        private void button2_Click(object sender, EventArgs e)
        {
            List<string> varCells=new List<string>();
            delIndex = dataGridView1.CurrentCell.RowIndex;
            int j = delIndex;
            int n = tablecolumns.Count;
            //dataGridView1.Rows[i].Cells[j].Value
            for (int i=0;i<n;i++)
            {

                string s = "";
                varCells.Add(s+dataGridView1.Rows[j].Cells[i].Value);

            }
            try
            {

                UpdateForm f = new UpdateForm(tablecolumns, varCells,connString,tableName);
                f.ShowDialog();
                varCells.Clear();
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 56
0
        public void checkUpdate()
        {
            if (string.IsNullOrEmpty(config.UpdateUrl))
                config.UpdateUrl = updateUrl;

            SoftUpdate app = new SoftUpdate(config.UpdateUrl, Application.ExecutablePath, "zha7idle");
            try
            {
                MyMessageForm mMsgForm = new MyMessageForm();
                if (app.IsUpdate && mMsgForm.Show(string.Format("检查到新版本{0},是否更新?\r\n更新说明:\r\n{1}", app.NewVerson, app.UpdateHelp), "更新日志", MyMessageForm.MessageButton.YesNo) == DialogResult.Yes)
                {
                    upform = new UpdateForm(app);
                    upform.ShowDialog();
                }
                tmpnotice = app.Notice;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 57
0
        public WebResource ShowProperties(IOrganizationService service, Control mainControl)
        {
            var form = new UpdateForm(this, service)
            {
                StartPosition = FormStartPosition.CenterParent
            };

            if (form.ShowDialog(mainControl) == DialogResult.OK)
            {
                return form.WebRessource;
            }

            return this;
        }
Esempio n. 58
0
        private static void ShowUI()
        {
            var updateForm = new UpdateForm();

            updateForm.ShowDialog();
        }
Esempio n. 59
0
        public void StartUpdateProcess(Version newVersion)
        {
            localPath = Path.Combine(Path.GetTempPath(), "MLifter" + newVersion.Major + newVersion.Minor + "Setup.exe");
            downloadPath = @"http://services.memorylifter.com/update/program/" + newVersion.ToString(3) + "/MemoryLifter-Setup.exe";

            UpdateForm updateForm = new UpdateForm(this, newVersion);
            updateForm.ShowDialog();
        }
Esempio n. 60
0
 //检查更新
 private void UpdateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         _checkUpdate = new CheckUpdate();
         if (_checkUpdate.IsConnectedInternet())
         {
             if (_checkUpdate.Download())
             {
                 if (_checkUpdate.HasNewVersion())
                 {
                     form_Update = UpdateForm.GetInstance(_checkUpdate.NewVersion);
                     form_Update.CloseHandlor += new UpdateForm.CloseHandler(CloseDeskHelper);
                     form_Update.ShowForm();
                 }
                 else//HasNewVersion()
                 {
                     MessageBox.Show("已经是最新版本");
                 }
             }
             else//Download()
             {
                 MessageBox.Show("已经是最新版本");
             }
         }
         else//IsConnectedInternet()
         {
             MessageBox.Show("本机没有连接互联网");
         }
     }
     catch (Exception ex)
     {
         log.WriteLog(ex.ToString());
     }
 }