private void btnNext_Click(object sender, EventArgs e) { if (txtDiskName.Text == "") { lblDiskName.ForeColor = System.Drawing.Color.Red; return; } using (StoragesDB _db = new StoragesDB()) { DataTable _dt = _db.ExecuteQuery("select * from STORAGES where STORAGENAME=`" + txtDiskName.Text + "`"); if (_dt.Rows.Count != 0) { lblDiskNameExists.Text = MMUtils.GetString("newnetworkdiskdlg.lblDiskNameExists.text"); return; } _db.ExecuteNonQuery("insert into STORAGES values(" + "`" + txtDiskName.Text + "`," + "`" + "networkdisk" + "`," + "``, ``, ``, ``, 0, 0)"); } this.DialogResult = DialogResult.OK; }
public CloudStorageDlg() { InitializeComponent(); aHelpProvider.HelpNamespace = MMUtils.instPath + "\\Synergy.chm"; aHelpProvider.SetHelpNavigator(this, HelpNavigator.Topic); aHelpProvider.SetHelpKeyword(this, "publishmap.htm"); // TODO Text = MMUtils.GetString("cloudstoragedlg.dlgtitle"); lblChooseStorage.Text = MMUtils.GetString("cloudstoragedlg.lblChooseStorage.text"); btnAddNewStorage.Text = MMUtils.GetString("cloudstoragedlg.btnAddNewStorage.text"); lblPlaceName.Text = MMUtils.GetString("cloudstoragedlg.lblPlaceName.text"); lblPlaceNameExists.Text = ""; btnCancel.Text = MMUtils.GetString("buttonCancel.text"); btnNext.Text = MMUtils.GetString("buttonNext.text"); btnBack.Text = MMUtils.GetString("buttonBack.text"); tltPlaceName.SetToolTip(help, MMUtils.GetString("cloudstoragedlg.PlaceName.tooltip")); using (StoragesDB _db = new StoragesDB()) { DataTable _dt = _db.ExecuteQuery("select * from STORAGES"); foreach (DataRow _row in _dt.Rows) { if (_row["TYPE"].ToString() == "cloud") { comboStorageName.Items.Add(_row["STORAGENAME"]); } } comboStorageName.SelectedIndex = 0; txtPlaceName.Text = comboStorageName.Text; } }
public NetworkDiskDlg() { InitializeComponent(); aHelpProvider.HelpNamespace = MMUtils.instPath + "\\Synergy.chm"; aHelpProvider.SetHelpNavigator(this, HelpNavigator.Topic); aHelpProvider.SetHelpKeyword(this, "publishmap.htm"); // TODO Text = MMUtils.GetString("networkdiskdlg.dlgtitle"); lblChooseND.Text = MMUtils.GetString("networkdiskdlg.lblChooseND.text"); btnAddNewDisk.Text = MMUtils.GetString("cloudstoragedlg.btnAddNewStorage.text"); lblPlace.Text = MMUtils.GetString("networkdiskdlg.lblNetworkDisk.text"); lblPlaceNameExists.Text = ""; btnCancel.Text = MMUtils.GetString("buttonCancel.text"); btnNext.Text = MMUtils.GetString("buttonNext.text"); btnBack.Text = MMUtils.GetString("buttonBack.text"); using (StoragesDB _db = new StoragesDB()) { DataTable _dt = _db.ExecuteQuery("select * from STORAGES"); foreach (DataRow _row in _dt.Rows) { if (_row["PROCESS"].ToString() != "" && _row["SITE"].ToString() == "") { comboDisks.Items.Add(_row["STORAGENAME"]); } } } if (comboDisks.Items.Count != 0) { comboDisks.SelectedIndex = 0; } else { using (NewNetworkDiskDlg _dlg = new NewNetworkDiskDlg()) { DialogResult result = _dlg.ShowDialog(new WindowWrapper((IntPtr)MMUtils.MindManager.hWnd)); aStorage = _dlg.txtDiskName.Text; if (result == DialogResult.Cancel) { this.DialogResult = DialogResult.Cancel; return; } if (result == DialogResult.Retry) { this.DialogResult = DialogResult.Retry; return; } comboDisks.Items.Add(aStorage); comboDisks.Text = aStorage; } } }
public void Init() { login_timer = new Timer(); login_timer.Interval = 50; login_timer.Tick += new EventHandler(Login_timer_Tick); // Init databases MapsDB _dbMaps = new MapsDB(); _dbMaps.Dispose(); UsersDB _dbUsers = new UsersDB(); _dbUsers.Dispose(); StoragesDB _dbStorages = new StoragesDB(); _dbStorages.Dispose(); PlacesDB _dbMyPlaces = new PlacesDB(); _dbMyPlaces.Dispose(); ProjectsDB _dbMyProjects = new ProjectsDB(); _dbMyProjects.Dispose(); CreateLogin(); }
private void BtnOK_Click(object sender, EventArgs e) { string _docName = publishDoc.Name; string aPlaceName = comboMyPlaces.Text; string aGuid = publishDoc.Guid; string aLocalPath = ""; string aPath = ""; // full path to published map string aSite = ""; // website to check for Internet connection string aProcess = ""; // cloud app process to check if started string _projectName = ""; string aStorage = ""; // name of cloud app string aProjectPath = ""; bool singleMap = chBoxSingleMap.Checked; if (!singleMap) { _projectName = comboMyProjects.Text; } // Single Maps if (singleMap) { using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES where PLACENAME='" + aPlaceName + "'"); aProjectPath = _dt.Rows[0]["PLACEPATH"].ToString(); aStorage = _dt.Rows[0]["STORAGE"].ToString(); aLocalPath = MMUtils.m_SynergyLocalPath + aPlaceName + "\\"; } } // Projects else { using (ProjectsDB _db = new ProjectsDB()) { DataTable _dt = _db.ExecuteQuery( "select * from PROJECTS where PROJECTNAME='" + _projectName + "' and PLACENAME='" + aPlaceName + "'"); aProjectPath = _dt.Rows[0]["PROJECTPATH"].ToString(); aStorage = _dt.Rows[0]["STORAGE"].ToString(); aLocalPath = MMUtils.m_SynergyLocalPath + aPlaceName + "\\" + _projectName + "\\"; } } if (publishDoc.Path == "") // new map not saved yet { using (NewMapDlg _dlg = new NewMapDlg()) { if (_dlg.ShowDialog(new WindowWrapper((IntPtr)MMUtils.MindManager.hWnd)) == DialogResult.Cancel) { return; } _docName = _dlg.textBox_MapName.Text + ".mmap"; } } aLocalPath = aLocalPath + _docName; using (StoragesDB _db = new StoragesDB()) { DataTable _dt = _db.ExecuteQuery("select * from STORAGES where STORAGENAME='" + aStorage + "'"); aProcess = _dt.Rows[0]["PROCESS"].ToString(); aSite = _dt.Rows[0]["SITE"].ToString(); } // Full path to map in Place aPath = Path.Combine(aProjectPath, _docName); // TODO предложить выбрать сохранение под другим именем if (Directory.Exists(aPath)) // map with this name is stored already in this place { System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show( MMUtils.GetString("publishmapdlg.mapexists.message"), MMUtils.GetString("publishmapdlg.mapexists.caption"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); return; } string fail = ""; string messageSite = MMUtils.GetString("internet.sitefailed.message"); string messageProcess = MMUtils.GetString("internet.processfailed.message"); string messagePlace = MMUtils.GetString("internet.placefail.message"); string endMessage = MMUtils.GetString("internet.failed.endpubmessage"); while ((fail = Internet.CheckInternetAndProcess(aGuid, aStorage, aProcess, aSite, "", "publish")) != "") { string _message = "", arg = ""; if (fail == "processfail") { _message = messageProcess; arg = aStorage; } else if (fail == "placefail") { _message = messagePlace; arg = aPath; } else if (fail == "sitefail") { _message = messageSite; arg = aSite; } if (System.Windows.Forms.MessageBox.Show( String.Format(_message, arg) + endMessage, String.Format(MMUtils.GetString("internet.failed.caption"), _docName), System.Windows.Forms.MessageBoxButtons.RetryCancel, System.Windows.Forms.MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.Cancel) { this.DialogResult = DialogResult.Cancel; publishDoc = null; return; } if (fail == "sitefail") { System.Diagnostics.Process.Start(arg); // launch website } } try // Save map to Local { publishDoc.SaveAs(aLocalPath); } catch (Exception _e) // TODO cause!!! read-only, etc... имя файла уже исключено выше { MessageBox.Show("Error: " + _e.Message, "PublishMapDlg", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.Cancel; publishDoc = null; return; } //// Publish Map = set attributes to map, topics, relationships and boundaries and process links //// SUtils.singleMap = singleMap; Mindjet.MindManager.Interop.Transaction _tr = publishDoc.NewTransaction(""); _tr.IsUndoable = false; _tr.Execute += new Mindjet.MindManager.Interop.ITransactionEvents_ExecuteEventHandler(SUtils.PublishMap); _tr.Start(); /////////////////////////////////////////////////////////////////////////////////// publishDoc.Save(); if (SUtils.links.Count > 0) { using (LinkedFilesDlg _dlg = new LinkedFilesDlg(SUtils.links, publishDoc)) { DialogResult result = _dlg.ShowDialog(new WindowWrapper((IntPtr)MMUtils.MindManager.hWnd)); SUtils.links.Clear(); if (result == DialogResult.Cancel) { this.DialogResult = DialogResult.Cancel; publishDoc = null; return; } } } aPath = aPath + "\\"; // Map folder string mapFile = SUtils.modtime + ".mmap"; try // save map to Place { Directory.CreateDirectory(aPath + "share"); File.Copy(aLocalPath, aPath + mapFile); // copy as file!!! StreamWriter sw = new StreamWriter(File.Create(aPath + "info.ini")); sw.WriteLine(aStorage); // чтобы если нет Интернета или Процесса, выдать сообщение с именем хранилища sw.WriteLine(_projectName); // чтобы находить карту из Места в локальной папке Synergy sw.WriteLine(aGuid); sw.WriteLine(aProcess); // чтобы проверить Интернет и Процесс sw.WriteLine(aSite); // чтобы проверить Интернет и Процесс sw.Close(); } catch (Exception _e) // TODO cause!!! read-only, etc... { MessageBox.Show(this, "Error " + _e.Message, "title", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.Cancel; publishDoc = null; return; } MapsDB.AddMapToDB( aStorage, aPlaceName, _projectName, aGuid, _docName, aPath, // aPath - map directory in Place, with backslash aLocalPath, DateTime.UtcNow.ToString() + ";" + SUtils.currentUserName + ";" + SUtils.currentUserEmail ); MapsGroup.m_UpdateOpenMap = true; // update Open Map submenu SUtils.ProcessMap(publishDoc); // Share map using (ShareMapDlg _dlg = new ShareMapDlg(MMUtils.ActiveDocument.Name, aPath)) { _dlg.ShowDialog(new WindowWrapper((IntPtr)MMUtils.MindManager.hWnd)); } this.DialogResult = DialogResult.OK; publishDoc = null; }
private void btnNext_Click(object sender, EventArgs e) { // Storage name is empty if (txtNewStorageName.Text == "") { lblNewStorageName.ForeColor = System.Drawing.Color.Red; return; } // Process field is empty if (txtProcess.Text == "") { lblProcess.ForeColor = System.Drawing.Color.Red; return; } // Site url is empty if (txtSiteUrl.Text == "") { lblSiteUrl.ForeColor = System.Drawing.Color.Red; return; } string aProcess = txtProcess.Text; string aStorageName = txtNewStorageName.Text; if (aProcess.Length > 4 && aProcess.Substring(aProcess.Length - 4) == ".exe") { aProcess = aProcess.Substring(0, aProcess.Length - 4); } // If Storage with this name exists using (StoragesDB _db = new StoragesDB()) { DataTable _dt = _db.ExecuteQuery("select * from STORAGES where STORAGENAME=`" + aStorageName + "`"); if (_dt.Rows.Count != 0) { lblNameExists.Text = MMUtils.GetString("newcloudstoragedlg.lblNameExists.text"); return; } } // Storage App verification failed if (!System.Diagnostics.Process.GetProcessesByName(aProcess).Any()) { MessageBox.Show( String.Format(MMUtils.GetString("newcloudstoragedlg.messagebox.text"), aStorageName), MMUtils.GetString("newcloudstoragedlg.messagebox.caption"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // Verify website using (SiteVerificationDlg _dlg = new SiteVerificationDlg(txtSiteUrl.Text)) { if (_dlg.ShowDialog(new WindowWrapper((IntPtr)MMUtils.MindManager.hWnd)) == DialogResult.Cancel) { return; } } using (StoragesDB _db = new StoragesDB()) { string _type = "cloud"; _db.ExecuteNonQuery("INSERT INTO STORAGES VALUES(" + "`" + aStorageName + "`," + "`" + aProcess + "`," + "`" + txtSiteUrl.Text + "`," + "`" + _type + "`, ``, ``, 0, 0)"); } this.DialogResult = DialogResult.OK; }