private void connetToNetworkToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("This tool will do clear install of application. All app data will be lost. Do you want to continue?", "Override files?", MessageBoxButtons.YesNo) == DialogResult.Yes) { UserDialog userDialog = new UserDialog(); if (userDialog.ShowDialog() == DialogResult.OK) { try { Form1_FormClosing(null, null); MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider(); string @string = Encoding.UTF8.GetString(mD5CryptoServiceProvider.ComputeHash(Encoding.UTF8.GetBytes(userDialog.UserName))); Settings.Default.UserToken = @string; FileManager.CreateHFOStructure(); this.filesSystem.ClearStart(); if (connectionRuns != null) { connectionControler.SetClose(); connectionRuns.Wait(); } connectionControler = new Connections(filesSystem, new MyDevice(0, userDialog.PCName, Communication.Network, "", "", ""), filesSystem.syncManager, this); connectionControler.ConnectingToNetwork(data).Wait(); filesSystem.dataHolder.Reload(); filesSystem = new FileManager(filesSystem.dataHolder); filesSystem.AddLocalDiskToManager(data.devices.Find(i => i.Id == Settings.Default.localDevId)); //restart app Settings.Default.Save(); DialogResult = DialogResult.Retry; Close(); }catch (Exception exc) { } } } }
private void createNewNetworkToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("This tool will do clear install of application. All app data will be lost. Do you want to continue?", "Override files?", MessageBoxButtons.YesNo) == DialogResult.Yes) { UserDialog userDialog = new UserDialog(); if (userDialog.ShowDialog() == DialogResult.OK) { Form1_FormClosing(null, null); MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider(); string @string = Encoding.UTF8.GetString(mD5CryptoServiceProvider.ComputeHash(Encoding.UTF8.GetBytes(userDialog.UserName))); Settings.Default.UserToken = @string; FileManager.CreateHFOStructure(); this.filesSystem.ClearStart(); filesSystem = new FileManager(filesSystem.dataHolder); this.filesSystem.AddNewDevice(userDialog.PCName); //restart app Settings.Default.Save(); DialogResult = DialogResult.Retry; Close(); } } }