private void btnNext_Click(object sender, EventArgs e) { aPlaceName = txtNetworkDiskName.Text; // If Place with this name exists using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES"); foreach (DataRow _row in _dt.Rows) { // Storage name exists if (aPlaceName == _row["PLACENAME"].ToString()) { lblPlaceNameExists.Text = MMUtils.GetString("cloudstoragedlg.lblPlaceNameExists.text"); return; } } } if (aPlaceName == "") { lblPlace.ForeColor = System.Drawing.Color.Red; } else { this.DialogResult = DialogResult.OK; } }
private void ComboPlaces_SelectedIndexChanged(object sender, EventArgs e) { using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES where PLACENAME='" + comboPlaces.Text + "'"); aStorage = _dt.Rows[0]["STORAGE"].ToString(); aPlacePath = _dt.Rows[0]["PLACEPATH"].ToString(); } string LeaveInPlace = MMUtils.GetString("receivedmapdlg.rbtnLeaveInPlace.text"); if (aStorage == "OneDrive") { LeaveInPlace = LeaveInPlace + MMUtils.GetString("receivedmapdlg.LeaveInPlaceRec.text"); rbtnLeaveInPlace.Checked = true; HelpRecommend.Visible = true; } else { rbtnPlace.Checked = true; HelpRecommend.Visible = false; } rbtnLeaveInPlace.Text = LeaveInPlace; // For FolderBrowser dialog System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(aPlacePath).Parent; initfolder = dir.FullName.ToString(); }
public CreateProjectDlg() { InitializeComponent(); aHelpProvider.HelpNamespace = MMUtils.instPath + "\\Synergy.chm"; aHelpProvider.SetHelpNavigator(this, HelpNavigator.Topic); aHelpProvider.SetHelpKeyword(this, "publishmap.htm"); // TODO Text = MMUtils.GetString("createprojectdlg.title"); lblPlace.Text = MMUtils.GetString("createprojectdlg.lblPlace.text"); lblProjectName.Text = MMUtils.GetString("createprojectdlg.lblProjectName.text"); btnCreate.Text = MMUtils.GetString("createprojectdlg.btnOK.text"); btnCancel.Text = MMUtils.GetString("buttonCancel.text"); lblProjectNameError.Text = ""; using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES"); if (_dt.Rows.Count != 0) { foreach (DataRow _row in _dt.Rows) { comboPlaces.Items.Add(_row["PLACENAME"]); } } } // No places yet if (comboPlaces.Items.Count == 0) { if (MessageBox.Show(MMUtils.GetString("createprojectdlg.noplaces.text"), MMUtils.GetString("createprojectdlg.noplaces.caption"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { this.DialogResult = DialogResult.Cancel; return; } using (Places.NewPlaceDlg _dlg = new Places.NewPlaceDlg()) { if (_dlg.ShowDialog(new WindowWrapper((IntPtr)MMUtils.MindManager.hWnd)) == DialogResult.Cancel) { this.DialogResult = DialogResult.Cancel; return; } aPlaceName = _dlg.aPlaceName; } comboPlaces.Items.Add(aPlaceName); } comboPlaces.Text = comboPlaces.Items[0].ToString(); }
private void btnCreate_Click(object sender, EventArgs e) { string aStorage = ""; // name of Storage string aProjectPath = ""; string aPlaceName = comboPlaces.Text; // name of selected Place string aPlacePath = ""; string aProjectName = txtProjectName.Text; // project to which we have to save the map using (ProjectsDB _db = new ProjectsDB()) { DataTable _dt = _db.ExecuteQuery("select * from PROJECTS where PROJECTNAME='" + aProjectName + "' and PLACENAME='" + aPlaceName + "'"); if (_dt.Rows.Count > 0) // project with this name already exists { lblProjectNameError.Text = MMUtils.GetString("createprojectdlg.projectexists.text"); return; } } // project name not entered if (aProjectName == "") { lblProjectNameError.Text = MMUtils.GetString("createprojectdlg.projectnameempty.text"); return; } using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES where PLACENAME='" + aPlaceName + "'"); aStorage = _dt.Rows[0]["STORAGE"].ToString(); aPlacePath = _dt.Rows[0]["PLACEPATH"].ToString(); } aProjectPath = aPlacePath + "$$" + aProjectName; string _localPath = MMUtils.m_SynergyLocalPath + aPlaceName + "\\" + aProjectName; try { System.IO.Directory.CreateDirectory(_localPath); System.IO.Directory.CreateDirectory(aProjectPath); // in the Place } catch (Exception _e) // TODO cause!!! read-only, etc... { MessageBox.Show(this, "Error " + _e.Message, "title", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.Cancel; // TODO } ProjectsDB.AddProjectToDB(aStorage, aPlaceName, aProjectName, aProjectPath, _localPath); this.DialogResult = DialogResult.OK; }
public PublishMaptDlg(Mindjet.MindManager.Interop.Document _doc) { InitializeComponent(); aHelpProvider.HelpNamespace = MMUtils.instPath + "\\Synergy.chm"; aHelpProvider.SetHelpNavigator(this, HelpNavigator.Topic); aHelpProvider.SetHelpKeyword(this, "publishmap.htm"); Text = MMUtils.GetString("publishmapdlg.dlgtitle.text"); lblPickPlace.Text = MMUtils.GetString("publishmapdlg.lblPickPlace.text"); chBoxSingleMap.Text = MMUtils.GetString("publishmapdlg.chBoxSingleMap.text"); lblPickProject.Text = MMUtils.GetString("publishmapdlg.lblPickProject.text"); btnPublish.Text = MMUtils.GetString("publishmapdlg.btn_publish.text"); btnCancel.Text = MMUtils.GetString("buttonCancel.text"); using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES order by PLACENAME"); foreach (DataRow _row in _dt.Rows) { comboMyPlaces.Items.Add(_row["PLACENAME"]); } } comboMyPlaces.SelectedIndex = 0; GetProjects(); if (comboMyProjects.Items.Count != 0) { comboMyProjects.Text = comboMyProjects.Items[0].ToString(); hasProjects = true; } else { comboMyProjects.Items.Add(MMUtils.GetString("publishmapdlg.noprojects")); comboMyProjects.SelectedIndex = 0; comboMyProjects.Enabled = false; hasProjects = false; } publishDoc = _doc; }
private void btnNext_Click(object sender, EventArgs e) { aPlaceName = txtPlaceName.Text; aStorage = comboStorageName.Text; if (aPlaceName == "") { lblPlaceName.ForeColor = System.Drawing.Color.Red; return; } // Check Place if exists using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES where PLACENAME=`" + aPlaceName + "`"); if (_dt.Rows.Count != 0) { lblPlaceNameExists.Text = MMUtils.GetString("cloudstoragedlg.lblPlaceNameExists.text"); return; } } this.DialogResult = DialogResult.OK; }
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; }
public void m_cmdOpenMaps_UpdateState(ref bool pEnabled, ref bool pChecked) { pEnabled = true; pChecked = false; if (!m_UpdateOpenMap) { return; } m_UpdateOpenMap = false; int a = 1; List <string> aProjects = new List <string>(); List <string> aSingleMaps = new List <string>(); if (OpenButtons.Count != 0) { foreach (SubMenus item in OpenButtons) { item.Destroy(); } for (int i = 0; i < Labels.Count; i++) { Labels[i].Delete(); Marshal.ReleaseComObject(Labels[i]); Labels[i] = null; } } OpenButtons.Clear(); Labels.Clear(); using (ProjectsDB _db = new ProjectsDB()) { DataTable _dt = _db.ExecuteQuery("select * from PROJECTS order by PROJECTNAME"); foreach (DataRow _row in _dt.Rows) { aProjects.Add(_row["PROJECTNAME"].ToString()); } } using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES order by PLACENAME"); foreach (DataRow _row in _dt.Rows) { aSingleMaps.Add(_row["PLACENAME"].ToString()); } } using (MapsDB _db = new MapsDB()) { bool _label = true; Control m_label = null; // Get maps by projects foreach (string _project in aProjects) { DataTable _dt = _db.ExecuteQuery("select * from MAPS where PROJECTNAME=`" + _project + "` order by MAPNAME"); foreach (DataRow _row in _dt.Rows) { if (_label) { m_label = m_ctrlOpenMaps.Controls.AddLabel(_project); _label = false; Labels.Add(m_label); } m_menus = new SubMenus(); OpenButtons.Add(m_menus); m_menus.AddMapToOpenMenu(_row["MAPGUID"].ToString(), _row["MAPNAME"].ToString(), "map" + a++); } _label = true; } //_label = true; // Get single maps foreach (string _place in aSingleMaps) { DataTable _dt = _db.ExecuteQuery("select * from MAPS where PROJECTNAME = `" + "" + "` and PLACENAME=`" + _place + "` order by MAPNAME"); //DataTable __dt = _db.ExecuteQuery("select * from MAPS"); foreach (DataRow _row in _dt.Rows) { if (_label) { m_label = m_ctrlOpenMaps.Controls.AddLabel(_place + ": " + SUtils.SingleMaps); _label = false; Labels.Add(m_label); } m_menus = new SubMenus(); OpenButtons.Add(m_menus); m_menus.AddMapToOpenMenu(_row["MAPGUID"].ToString(), _row["MAPNAME"].ToString(), "map" + a++); } _label = true; } aProjects.Clear(); aSingleMaps.Clear(); } }
public void m_cmdLogin_Click() { DialogResult result = DialogResult.None; ////// LOG IN /////////////////////////// if (logged == false) { if (MMUtils.GetRegistry("", "RememberMe") == "1") { MMUtils.SetRegistry("", "CurrentUserName", MMUtils.GetRegistry("", "RememberedUserName")); MMUtils.SetRegistry("", "CurrentUserEmail", MMUtils.GetRegistry("", "RememberedUserEmail")); } else { using (LogInDlg _dlg = new LogInDlg()) result = _dlg.ShowDialog(new WindowWrapper((IntPtr)MMUtils.MindManager.hWnd)); if (result == DialogResult.Cancel) { return; } } // Check for Places bool _noplaces = false; using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES"); if (_dt.Rows.Count == 0) // No places yet { _noplaces = true; } } if (_noplaces) { using (FirstUserDlg _dlg = new FirstUserDlg()) { result = _dlg.ShowDialog(new WindowWrapper((IntPtr)MMUtils.MindManager.hWnd)); if (result == DialogResult.Cancel) { return; } System.Windows.Forms.MessageBox.Show(MMUtils.GetString("places.placecreated.message")); } } SUtils.currentUserName = MMUtils.GetRegistry("", "CurrentUserName"); SUtils.currentUserEmail = MMUtils.GetRegistry("", "CurrentUserEmail"); logged = true; SynergyRibbon.Visible = true; SendKeys.SendWait("%(S)"); // Opens Synergy Ribbon Tab } //////// LOG OUT //////////////////////////// else { using (LogOutDlg _dlg = new LogOutDlg()) { result = _dlg.ShowDialog(new WindowWrapper((IntPtr)MMUtils.MindManager.hWnd)); } if (result == System.Windows.Forms.DialogResult.Cancel) { return; } // Close all Synergy maps bool _closeMaps = false; foreach (Document _doc in MMUtils.MindManager.AllDocuments) { if (_doc.HasAttributesNamespace[SUtils.SYNERGYNAMESPACE]) { if (_closeMaps) { docstoclose.Add(_doc); continue; } if (MessageBox.Show(MMUtils.GetString("maps.userlogout.message"), "", System.Windows.Forms.MessageBoxButtons.YesNo) == DialogResult.No) { return; } _closeMaps = true; docstoclose.Add(_doc); } } logged = false; SynergyRibbon.Visible = false; } login_timer.Start(); }
public MapReceivedDlg() { InitializeComponent(); aHelpProvider.HelpNamespace = MMUtils.instPath + "\\Synergy.chm"; aHelpProvider.SetHelpNavigator(this, HelpNavigator.Topic); aHelpProvider.SetHelpKeyword(this, "receive.htm"); Text = MMUtils.GetString("receivedmapdlg.dlgtitle.text"); lblPlace.Text = MMUtils.GetString("receivedmapdlg.lblPlace.text"); linkNewPlace.Text = MMUtils.GetString("receivedmapdlg.linkNewPlace.text"); lblReceivedFolderPath.Text = MMUtils.GetString("receivedmapdlg.lblReceivedFolderPath.text"); rbtnPlace.Text = MMUtils.GetString("receivedmapdlg.rbtnPlace.text"); rbtnProject.Text = MMUtils.GetString("receivedmapdlg.rbtnProject.text"); btnCancel.Text = MMUtils.GetString("buttonCancel.text"); using (PlacesDB _db = new PlacesDB()) { DataTable _dt = _db.ExecuteQuery("select * from PLACES"); foreach (DataRow _row in _dt.Rows) { comboPlaces.Items.Add(_row["PLACENAME"]); } aStorage = _dt.Rows[0]["STORAGE"].ToString(); aPlacePath = _dt.Rows[0]["PLACEPATH"].ToString(); } comboPlaces.SelectedIndex = 0; rbtnPlace.Checked = true; string LeaveInPlace = MMUtils.GetString("receivedmapdlg.rbtnLeaveInPlace.text"); if (aStorage == "OneDrive") { LeaveInPlace = LeaveInPlace + MMUtils.GetString("receivedmapdlg.LeaveInPlaceRec.text"); rbtnLeaveInPlace.Checked = true; } rbtnLeaveInPlace.Text = LeaveInPlace; using (ProjectsDB _db = new ProjectsDB()) { DataTable _dt = _db.ExecuteQuery("select * from PROJECTS where PLACENAME=`" + comboPlaces.Text + "` order by PROJECTNAME"); foreach (DataRow _row in _dt.Rows) { comboProjects.Items.Add(_row["PROJECTNAME"]); } } if (comboProjects.Items.Count == 0) { comboProjects.Items.Add(MMUtils.GetString("receivedmapdlg.noprojects")); comboProjects.Enabled = false; rbtnProject.Enabled = false; } comboProjects.SelectedIndex = 0; // For FolderBrowser dialog System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(aPlacePath).Parent; initfolder = dir.FullName.ToString(); }