private void button1_Click(object sender, System.EventArgs e) { this.Hide(); FilesForm mainForm = new FilesForm(); mainForm.Show(); }
public Form1() { InitializeComponent(); _filesForm = new FilesForm(); _filesForm.FileSelectionChanged += _filesForm_FileSelectionChanged; _filesForm.Show(dockPanel1); _explorer = new FolderExplorer(); _explorer.FolderLocationChanged += explorer_FolderLocationChanged; _explorer.Show(dockPanel1, DockState.DockLeft); _errors = new ErrorsForm(); _errors.Show(dockPanel1, DockState.DockBottom); _descriptionForm = new DescriptionForm(); _descriptionForm.Show(dockPanel1, DockState.DockRight); var dirToOpen = Settings.Default.LastViewedDirectory; if (String.IsNullOrEmpty(dirToOpen)) { dirToOpen = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } OpenDirectory(dirToOpen); Descriptors = new List <IDescriptor>(); LoadDescriptors(); }
private void backEditButton_Click(object sender, EventArgs e) { Hide(); FilesForm filesForm = new FilesForm(Username, Password); filesForm.Show(); }
private void btnLogin_Click(object sender, EventArgs e) { int userId = 0; if (checkBox1.Checked) { //if the admin exits in the database //show admin page int adminId = RepositoryUser.CheckAdmin(usernameTextBox.Text, true); if (adminId != 0) { AdminForm adminForm = new AdminForm(); adminForm.Show(); } else { loginLabel.Text = "Unrecognized admin. Please try again!"; loginLabel.TextAlign = ContentAlignment.MiddleCenter; loginLabel.ForeColor = System.Drawing.Color.Red; loginLabel.Show(); usernameTextBox.Text = ""; passwordTextBox.Text = ""; checkBox1.Checked = false; } } else { //with false // show a normal user form userId = UserService.LoginUser(usernameTextBox.Text, passwordTextBox.Text); if (userId != 0) { FilesForm formFiles = new FilesForm(usernameTextBox.Text, passwordTextBox.Text); Hide(); formFiles.Show(); } else { loginLabel.Text = "Your credentials are incorrect. Please try again"; loginLabel.ForeColor = System.Drawing.Color.Red; usernameTextBox.Text = ""; passwordTextBox.Text = ""; } } }
public MetadataForm(FilesForm mainForm) { }
protected override void OnButtonAction(XRibbonButton xRibbonButton, RibbonEventArgs e) { OfficeWord.Application app = SceneContext.Instance.WordAppAdmin.Application; var file = new FilesForm(context, app); if (file.ShowDialog() == DialogResult.OK) { if (string.IsNullOrEmpty(file.LocalFileName)) { return; } // 关闭当前的文档 object missing = System.Reflection.Missing.Value; var newFile = new FileInfo(file.LocalFileName); if (newFile.Exists) { // 注入用户数据 //CreateCustomXml(openFileName, loginObj); // 打开该文件 object fileNameObj = file.LocalFileName; object visible = true; app.ScreenUpdating = false; OfficeWord.Document wDoc = app.Documents.Open(ref fileNameObj, ref missing, ref missing , ref missing, ref missing, ref missing , ref missing, ref missing, ref missing , ref missing, ref missing, ref visible , ref missing, ref missing, ref missing , ref missing); app.ScreenUpdating = true; // 记录当前文档数据 var entry = new SecretEntry() { LoginEntity = null, BizFileName = file.LocalFileName, BizFileId = "", }; SceneContext.Instance.SecretDataAdmin.Set(wDoc, entry); //wDoc.ActiveWindow.View.Type = Microsoft.Office.Interop.Word.WdViewType.wdPrintView; // 记录当前文档数据 //SecretEntry entry = new SecretEntry() //{ // LoginEntity = loginEntity, // BizFileName = fileInfo.FullName, // BizFileId = fileInfo.FileId, // AuthAdmin = secretEntry.AuthAdmin, //}; //context.SecretDataAdmin.Set(wDoc, entry); // 获取数据 //string xml = wDoc.SelectPartXmlByNamespace("---namespace----"); //object saveChange = false; //doc.Close(ref saveChange, ref nullobj, ref nullobj); } } //var dialog = new F.OpenFileDialog(); //dialog.InitialDirectory = @"C:\"; //dialog.Filter = "所有Word文档|*.docx;*.docm;*.dotx;*.doc;*.dot;*.htm;*.html|Word文档|*.docx|启用宏的Word文档|*.docm|Xml文件|*.xml|Word97-2003文档|*.doc"; //dialog.FilterIndex = 1; //if (dialog.ShowDialog() == F.DialogResult.OK) //{ // string fileName = dialog.FileName; // //// 检查文件是否已打开 // //string fileName = context.WordAppAdmin.Application.ActiveDocument.Name; // //if (fileName.Equals(dialog.FileName)) // //{ // // MessageBox.Show(string.Format("文件 {0}已打开.",fileName)); // // return false; // //} }
public void StripButtonClickHandler(object sender, ToolStripEventArgs e) { switch (e.Action) { case ToolStripAction.Capture: this.ZWPictureBox.LaserFunction = false; CaptureImage(); break; case ToolStripAction.Video: this.ZWPictureBox.LaserFunction = false; break; case ToolStripAction.Archive: this.ZWPictureBox.LaserFunction = false; filesForm = new FilesForm(); filesForm.ShowDialog(); break; case ToolStripAction.ZoomOut: this.ZWPictureBox.LaserFunction = false; this.ZWPictureBox.ZoonOut(); break; case ToolStripAction.ZoomIn: this.ZWPictureBox.LaserFunction = false; this.ZWPictureBox.ZoomIn(); break; case ToolStripAction.ZoomFit: this.ZWPictureBox.LaserFunction = false; this.ZWPictureBox.ZoomFit(); break; case ToolStripAction.Scale: this.ZWPictureBox.LaserFunction = false; ToolStripButton toolStripButton = sender as ToolStripButton; toolStripButton.Checked = !toolStripButton.Checked; this.ZWPictureBox.Rulers.ShowRulers = toolStripButton.Checked; this.ZWPictureBox.Invalidate(); break; case ToolStripAction.Line: case ToolStripAction.Rectangle: case ToolStripAction.Ellipse: case ToolStripAction.Polygon: this.ZWPictureBox.LaserFunction = false; SetMeasureTool(e.Action, false); this.ZWPictureBox.ShowBaseCtrl(true, 2); this.ZWPictureBox.Invalidate(); break; case ToolStripAction.Move: SetMeasureTool(e.Action, false); break; case ToolStripAction.Laser: this.ZWPictureBox.LaserFunction = true; this.ZWPictureBox.ShowBaseCtrl(true, 0); this.ZWPictureBox.GraphicsList.DeleteAll(); this.ZWPictureBox.Invalidate(); break; case ToolStripAction.Setting: this.ZWPictureBox.LaserFunction = false; this.ZWPictureBox.ShowBaseCtrl(true, 4); break; case ToolStripAction.OpenFile: this.ZWPictureBox.LaserFunction = false; OpenFile(); break; case ToolStripAction.PortConfig: this.ZWPictureBox.ShowBaseCtrl(true, 7); break; } }