internal void TortoiseSvn(string strTarget, string strCommand, string strSvnPath, string strSvnUrl) { string strTSVN; string strCOM; string strPATH; string strURL; string strLOG; RegistryManager reg = new RegistryManager(); if ((strTarget=="Project" && env.Project.TortoiseSVN) || (strTarget=="Master" && env.Master.TortoiseSVN)){ strTSVN = reg.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\TortoiseSVN","ProcPath"); if (strTSVN==null || strTSVN=="") return; strCOM = " /command:" + strCommand + " /notempfile "; strPATH=" /path:\"" + strSvnPath+"\""; strURL = " /url:\"" + strSvnUrl + "\""; strLOG = " /logmsg:\"" + strCommand + "-" + strSvnPath + "-" + strSvnUrl + "\""; Process.Start(strTSVN, strCOM + strPATH + strURL + strLOG); } }
//外部ファイルの呼び出し private void CallWindow(int row_index) { string f_name = ds_main.Tables["Task"].Rows[row_index][3].ToString(); string strTaskPath = env_data.Project.Folder + env_data.Project.SelectedFolder + @"\"; string app_name; string ext; Process p; if (f_name.Length == 0) { Random rnd = new Random(); string rnd_str = rnd.Next(100).ToString("D2"); f_name = DateTime.Now.ToString("yyyyMMddhhmmss") +rnd_str + ".txt"; if (!File.Exists(strTaskPath + f_name)) { StreamWriter sw = File.CreateText(strTaskPath + f_name); sw.Close(); } ds_main.Tables["Task"].Rows[row_index][3] = f_name; SaveData(); } if (!File.Exists(strTaskPath + f_name)) { if (Path.GetExtension(f_name) == ".txt" || Path.GetExtension(f_name) == ".csv" || Path.GetExtension(f_name) == ".xml") File.Create(strTaskPath + f_name); else { MessageBox.Show("ファイルが見つかりません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } ext = Path.GetExtension(f_name); if (ext == ".txt" && env_data.Documents.Editor.Length > 5) { app_name = env_data.Documents.Editor; } else { RegistryManager reg = new RegistryManager(); app_name = reg.GetApplicationFullPathByExtension(ext); if (app_name == "") { app_name = reg.GetApplicationFileByExtension(ext); if (app_name == "") { try { p = Process.Start(strTaskPath + f_name); } catch (Exception ex) { throw new Exception(ex.Message); } return; } } } try { p = Process.Start(app_name, strTaskPath + f_name); } catch (Exception ex) { try { p = Process.Start(strTaskPath + f_name); } catch { throw ex; } } }
//デフォルトのブラウザの取得 private string GetDefaultBrowser() { RegistryManager reg = new RegistryManager(); return reg.GetApplicationFullPathByExtension(".html"); }
//メソッド #region Methods //初期化 private void Init(OpenWindowType c_window) { this.c_window = c_window; DataTable dt; switch (c_window) { //環境設定 case OpenWindowType.ENV_SETTINGS: pnlTaskGet.Visible = false; pnlProjectData.Visible = false; pnlMasterList.Visible = false; pnlMaster.Visible = false; pnlGetProject.Visible = false; pnlDeleteProject.Visible = false; pnlVersion.Visible = false; pnlWizard.Visible = false; pnlWizard02.Visible = false; pnlWizard03.Visible = false; pnlWizard10.Visible = false; pnlWizard20.Visible = false; tbx0101.Text = env.Documents.Path; tbx0201.Text = folder; tbx0301.Text = env.Master.Folder; checkBox1.Checked = env.Project.TortoiseSVN; checkBox2.Checked = env.Master.TortoiseSVN; checkBox3.Checked = env.Project.DropBox; tbx0202.Text = env.Project.URL; tbx0302.Text = env.Master.URL; txtEditor.Text = env.Documents.Editor; if (env.Documents.Editor == "") cbxEditor.Checked = true; RegistryManager reg = new RegistryManager(); string txt = reg.GetApplicationFileByExtension(".txt"); if (txt.Length == 0) txt = "なし"; cbxEditor.Text = String.Format("既定のエディタを使用する ({0})", txt); break; //タスク追加 case OpenWindowType.ADD_TASK: this.Text = "タスク追加"; data_set = new DataSet(); pnlTaskGet.Visible = true; tbxTaskStartDate.Text = DateTime.Now.ToString("yyyy/MM/dd"); tbxTaskEndDate.Text = ""; SetComboList(); break; //タスク情報変更 case OpenWindowType.CHANGE_TASK: this.Text = "タスク情報変更"; label8.Text = "タスク情報変更"; label9.Text = "タスクの情報を下記のとおり変更します。"; btnChange.Text = "変更"; btnDeleteFile.Visible = true; pnlTaskGet.Visible = true; SetComboList(); break; //プロジェクトの作成 case OpenWindowType.CREATE_PROJECT: wizard_step = 0; this.Text = "プロジェクト作成ウィザード"; lblWizardTitle.Text = "プロジェクトについて"; pnlWizard.Visible = true; if (env.Master.Folder.Substring(env.Master.Folder.Length - 1) != @"\") { Master master = env.Master; master.Folder += @"\"; env.Master = master; env.SaveEnvData(); } master_file = env.Master.Folder + env.Master.SelectedFolder + @"\master.xml"; data_set = new DataSet(); data_set.ReadXml(master_file, XmlReadMode.ReadSchema); dt = data_set.Tables["申請一覧表"]; foreach (DataRow dr in dt.Rows) { cmbWizard0301.Items.Add(dr[0].ToString()); } data_set.ReadXml(env.Documents.Path); dt = data_set.Tables["担当者"]; foreach (DataRow dr in dt.Rows) { cmbWizard0302.Items.Add(dr[0].ToString()); } break; //プロジェクト情報の変更 case OpenWindowType.PROJECT_DATA: this.Text = "プロジェクト情報変更"; pnlProjectData.Visible = true; InitProjectData(); break; //プロジェクト取り込み case OpenWindowType.GET_PROJECT: this.Text = "取り込み元プロジェクト一覧"; pnlGetProject.Visible = true; data_set = new DataSet(); data_set.ReadXml(env.Documents.Path, XmlReadMode.ReadSchema); CreateListViewItem(); break; //プロジェクト削除 case OpenWindowType.DELETE_PROJECT: this.Text = "プロジェクト情報削除"; pnlDeleteProject.Visible = true; data_set = new DataSet(); data_set.ReadXml(env.Documents.Path, XmlReadMode.ReadSchema); DataRow del_dr = data_set.Tables["ProjectData"].Select("フォルダ名=" + env.Project.SelectedFolder)[0]; lblProjectNo.Text = del_dr[0].ToString(); lblProjectName.Text = del_dr[1].ToString(); break; //プロジェクト一覧作成 case OpenWindowType.CREATE_PROJECT_LIST: wizard_step = 0; this.Text = "プロジェクト一覧作成ウィザード"; lblWizardTitle.Text = "プロジェクト一覧について"; lblWizard01.Text = "docmaker.netでは自分が管理する\n業務案件を一覧にしたファイルを\n「プロジェクト一覧」と呼びます。"; lblWizard01.Text += "\n\nこのウィザードでは、新規に空のプロジェクト\n一覧を作成します。"; pnlWizard.Visible = true; break; //業務パックフォルダ変更 case OpenWindowType.GYOUMU_PACK: wizard_step = 0; this.Text = "業務パックフォルダ設定ウイザード"; lblWizardTitle.Text = "業務パックについて"; lblWizard01.Text = "docmaker.netでは業務に\n必要な様式、手順を記したファイルをまとめた"; lblWizard01.Text += "\nものを「業務パック」と呼びます。"; lblWizard01.Text += "\n\nこのウイザードでは、お使いのパソコンに業務\nパックを保存するフォルダを設定します。"; lblWizard01.Text += "\n\n併せて、インターネット経由で最新の業務\nパックに更新する設定も行うことができます。"; tbxWizard02Master.Text = env.Master.Folder; cbxWizard03Master.Checked = env.Master.TortoiseSVN; tbxWizard03Master.Text = env.Master.URL; pnlWizard.Visible = true; break; //事業所マスタ変更 case OpenWindowType.OFFICE_MASTER: this.Text = "事業所マスタ"; data_set = new DataSet(); try { data_set.ReadXml(env.Documents.Path, XmlReadMode.ReadSchema); } catch (Exception ex) { throw ex; } if (data_set.Tables.Contains("事業所")) { dt = data_set.Tables["事業所"]; if (dt.Rows.Count > 0) { tbxOfficeName.Text = dt.Rows[0][0] == null ? "" : dt.Rows[0][0].ToString(); tbxOfficeZip.Text = dt.Rows[0][1] == null ? "" : dt.Rows[0][1].ToString(); tbxOfficeAddress.Text = dt.Rows[0][2] == null ? "" : dt.Rows[0][2].ToString(); tbxOfficeTel.Text = dt.Rows[0][3] == null ? "" : dt.Rows[0][3].ToString(); tbxOfficeFax.Text = dt.Rows[0][4] == null ? "" : dt.Rows[0][4].ToString(); } else { dt.Rows.Add(dt.NewRow()); } } else { data_set.Tables.Add("事業所"); dt = data_set.Tables["事業所"]; dt.Columns.Add(new DataColumn("Name", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("Zip", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("Address", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("TEL", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("FAX", Type.GetType("System.String"))); dt.Rows.Add(dt.NewRow()); } pnlMaster.Visible = true; break; //担当者マスタ変更 case OpenWindowType.PERSON_MASTER: this.Text = "担当者マスタ"; lblOfficeMasterTitle.Text = "担当者マスタ"; data_set = new DataSet(); try { data_set.ReadXml(env.Documents.Path, XmlReadMode.ReadSchema); } catch (Exception ex) { throw ex; } foreach (DataRow dr in data_set.Tables["担当者"].Rows) { lviewMaster.Items.Add(new ListViewItem(dr[0].ToString())); } pnlMaster.Visible = true; pnlMasterList.Visible = true; break; //処理内容マスタ変更 case OpenWindowType.CATEGORY_MASTER: this.Text = "処理内容マスタ"; lblOfficeMasterTitle.Text = "処理内容マスタ"; lblMasterList.Text = "処理内容を選択して、もう一度クリックすると名前を編集できます。"; data_set = new DataSet(); try { data_set.ReadXml(env.Documents.Path, XmlReadMode.ReadSchema); } catch (Exception ex) { throw ex; } foreach (DataRow dr in data_set.Tables["タスク種別"].Rows) { lviewMaster.Items.Add(new ListViewItem(dr[0].ToString())); } pnlMaster.Visible = true; pnlMasterList.Visible = true; break; //状態マスタ変更 case OpenWindowType.STATUS_MASTER: this.Text = "状態マスタ"; lblOfficeMasterTitle.Text = "状態マスタ"; lblMasterList.Text = "状態を選択して、もう一度クリックすると名前を編集できます。"; data_set = new DataSet(); try { data_set.ReadXml(env.Documents.Path, XmlReadMode.ReadSchema); } catch (Exception ex) { throw ex; } foreach (DataRow dr in data_set.Tables["状態"].Rows) { lviewMaster.Items.Add(new ListViewItem(dr[0].ToString())); } pnlMaster.Visible = true; pnlMasterList.Visible = true; break; //バージョン情報表示 case OpenWindowType.VERSION: this.Text = "バージョン情報"; System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); lblVersion.Text = "Ver." + assembly.GetName().Version.Major + "." + assembly.GetName().Version.Minor + "." + assembly.GetName().Version.Build; pnlVersion.Visible = true; break; } }