Beispiel #1
0
        private void AddPhraseFiles(List <KeyValuePair <string, string> > fileUsages)
        {
            string fname;
            int    index;
            bool   used = false;

            foreach (KeyValuePair <string, string> pair in fileUsages)
            {
                fname = pair.Key.ToLower();
                if (String.IsNullOrEmpty(fname))
                {
                    continue;
                }
                if (!File.Exists(fname))        // 檔案如果不存在,就不加入
                {
                    MsgBoxHelper.ShowWarning("詞庫檔案不存在: " + fname + Environment.NewLine + "已自動將此檔案排除!");
                    continue;
                }
                used  = pair.Value.Equals("1");
                index = clbPhraseTbl.Items.IndexOf(fname);
                if (index < 0)  // 清單中沒有的項目才加入。
                {
                    clbPhraseTbl.Items.Add(fname, used);
                }
                else
                {
                    clbPhraseTbl.SetItemChecked(index, used);   // 已存在的項目只更改其勾選狀態。
                }
            }
        }
        /// <summary>
        /// 檢視模式:只顯示點字。
        /// </summary>
        private void ViewBrailleOnly()
        {
            MsgBoxHelper.ShowWarning("注意! 此為測試功能,若發現任何問題,請切回預設模式:\n" +
                                     "從主選單點選「檢視 > 模式 > 顯示全部」。");

            int row;

            brGrid.SuspendLayout();
            CursorHelper.ShowWaitCursor();
            try
            {
                for (row = 1; row < brGrid.RowsCount; row += 3)
                {
                    brGrid.Rows.HideRow(row + 1);
                    brGrid.Rows.HideRow(row + 2);
                }
                miViewBrailleOnly.Checked = true;
                miViewTextZhuyin.Checked  = false;
                miViewAll.Checked         = false;
            }
            finally
            {
                brGrid.ResumeLayout();
                ResizeCells();
                CursorHelper.RestoreCursor();
            }
        }
 public static void TryOpenFile(string fileName, Control parentControl = null)
 {
     try
     {
         Process.Start(fileName);
     }
     catch (Exception ex)
     {
         LoggerInstance.Log(ex);
         MsgBoxHelper.ShowWarning(parentControl, "Cannot open the specified file.");
     }
 }
Beispiel #4
0
 public void ShowWarning(string message) => MsgBoxHelper.ShowWarning(this, message);
Beispiel #5
0
 public void ShowWarning(string msg) => MsgBoxHelper.ShowWarning(this, msg);