GetValue() static public méthode

static public GetValue ( string itemName ) : string
itemName string
Résultat string
Exemple #1
0
        public LangComboxAdaptor(ToolStripComboBox combox, Form frm)
        {
            this.combox = combox;
            this.frm    = frm;

            combox.Items.Clear();

            string lang = StringResources.GetValue("lang");

            if (lang == null)
            {
                lang = "EN";
            }
            ArrayList tmpList = (ArrayList)Language.GetLanguageList(lang);

            foreach (string tmpStr in tmpList)
            {
                int idex = combox.Items.Add(tmpStr);

                if (getLangFromString(tmpStr) == lang)
                {
                    combox.SelectedIndex = idex;
                }
            }
            /* Reg Event */
            combox.SelectedIndexChanged += combox_SelectedIndexChanged;
        }
Exemple #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                if (wsp.NeedSave)
                {
                    alter_and_save();
                }
                try
                {
                    wsp.readWorkspaceFromFile(openFileDialog.FileName);
                }
                catch (Exception exp)
                {
                    MessageBox.Show(StringResources.GetValue("error_openfilefail")
                                    + "\r\n" + exp.ToString());

                    return;
                }
                this.Text = FROM_TITLE + new FileInfo(openFileDialog.FileName).Name;

                wsp_control_apt.page_right();
                toolStripComboBox_File.DroppedDown = true;
            }
        }
Exemple #3
0
        private void MainFrm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (wsp.NeedSave)
            {
                DialogResult tmp = MessageBox.Show(StringResources.GetValue("save_question"), "save", MessageBoxButtons.YesNoCancel);
                if (tmp == System.Windows.Forms.DialogResult.Yes)
                {
                    if (save_file(false) == System.Windows.Forms.DialogResult.OK)
                    {
                        MessageBox.Show(StringResources.GetValue("save_complete"));
                        e.Cancel = false;
                        this.Close();
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
                else if (tmp == System.Windows.Forms.DialogResult.No)
                {
                    e.Cancel = false;
                }
                else if (tmp == System.Windows.Forms.DialogResult.Cancel)
                {
                    e.Cancel = true;
                }
            }

            Properties.Settings.Default.Save();
        }
Exemple #4
0
        public MainFrm()
        {
            InitializeComponent();

            Language.InitFormLanguage(this, StringResources.GetValue("lang"));

            ToolStripButtonGroup modeBtnGroup = new ToolStripButtonGroup(toolStrip);

            modeBtnGroup.AddButton(toolStripButton_BrowseMode);
            modeBtnGroup.AddButton(toolStripButton_EditLabelMode);
            modeBtnGroup.AddButton(toolStripButton_InputMode);
            modeBtnGroup.AddButton(toolStripButton_CheckMode);

            wsp_control_apt = new WorkspaceControlAdpter(
                modeBtnGroup,
                toolStripComboBox_File,
                TranslateTextBox,
                TextBox_GroupBox,
                new ListViewAdpter(listView, wsp.GroupDefine),
                picView,
                contextMenuStripQuickText,
                toolStrip,
                wsp);

            zoomAdaptor = new ZoomAdaptor(picView,
                                          toolStripButton_ZoomPlus,
                                          toolStripButton_ZoomMinus,
                                          toolStripComboBox_Zoom);

            langComboxApt = new LangComboxAdaptor(langToolStripComboBox, this);

            SetLayout();
        }
Exemple #5
0
 private void listViewUserAction(object sender, ListViewAdpter.UserActionEventArgs e)
 {
     if (e.Action == ListViewAdpter.UserActionEventArgs.ActionType.del)
     {
         if (MessageBox.Show(
                 StringResources.GetValue("tip_sure_del_label"),
                 "warning",
                 MessageBoxButtons.YesNo,
                 MessageBoxIcon.Warning) != DialogResult.Yes)
         {
             return;
         }
     }
     picview.EnableMakeImage = false;
     if (e.Value <= wsp.GroupDefine.UserGroupCount)
     {
         for (int i = e.Index.Length - 1; i >= 0; i--)
         {
             int index = e.Index[i];
             if (e.Action == ListViewAdpter.UserActionEventArgs.ActionType.setGroup)
             {
                 wsp.Store.UpdateLabelCategory(fileName, index, e.Value);
             }
             else if (e.Action == ListViewAdpter.UserActionEventArgs.ActionType.del)
             {
                 wsp.Store.DelLabelItem(fileName, index);
             }
         }
     }
     picview.EnableMakeImage = true;
     picview.MakeImageNow();
 }
Exemple #6
0
 private void saveSToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (save_file(false) == System.Windows.Forms.DialogResult.OK)
     {
         MessageBox.Show(StringResources.GetValue("save_complete"));
         this.Text = FROM_TITLE + new FileInfo(wsp.Path).Name;
     }
 }
Exemple #7
0
        public ImageOutputFrm(Workspace wsp, PicView pv)
        {
            this.wsp = wsp;
            this.pv  = pv;

            InitializeComponent();

            Language.InitFormLanguage(this, StringResources.GetValue("lang"));
        }
Exemple #8
0
        private void outputAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!wsp.HavePath)
            {
                MessageBox.Show(StringResources.GetValue("input_images_need_save"));
                return;
            }

            new ImageOutputFrm(wsp, picView).ShowDialog();
        }
Exemple #9
0
        private void rebuildMenuStrip()
        {
            myMenuStrip.Items.Clear();
            foreach (string i in group.GetUserGroupNameArray())
            {
                myMenuStrip.Items.Add(i);
            }

            myMenuStrip.Items.Add(StringResources.GetValue("listview_menustrip_del"));
        }
Exemple #10
0
        //private void outputPhotoshopScriptToolStripMenuItem_Click(object sender, EventArgs e)
        //{
        //    if (!wsp.HavePath)
        //    {
        //        MessageBox.Show(StringResources.GetValue("input_images_need_save"));
        //        return;
        //    }

        //    new OutputScriptFrm(wsp).ShowDialog();
        //}
        private void imageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (wsp.HavePath)
            {
                new ManageImageFrm(wsp).ShowDialog();
            }
            else
            {
                MessageBox.Show(StringResources.GetValue("input_images_need_save"));
            }
        }
Exemple #11
0
        private void toolStripButton_Clear_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show(
                StringResources.GetValue("clear_all_label_question"),
                "warning!!!",
                MessageBoxButtons.YesNo);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                wsp.Store.DelAllLabelInFile(wsp_control_apt.FileName);
            }
        }
Exemple #12
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (wsp.NeedSave)
            {
                var saveResult = alter_and_save();
                if (saveResult == System.Windows.Forms.DialogResult.Yes)
                {
                    MessageBox.Show(StringResources.GetValue("save_complete"));
                }
                else if (saveResult == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }
            }

            wsp_control_apt.NewFile();
            wsp.NewFile();
            this.Text = FROM_TITLE;

            folderBrowserDialog.Description = StringResources.GetValue("tip_chose_photo_dir");
            if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DirectoryInfo dirInfo = new DirectoryInfo(folderBrowserDialog.SelectedPath);
                if (dirInfo.Exists)
                {
                    //目录可用
                    string filename = "work.txt";
                    int    order    = 0;
                    do
                    {
                        filename = StringResources.GetValue("default_file_name") + "_" + order + ".txt";
                        wsp.Path = dirInfo.FullName + "\\" + filename;
                        ++order;
                    } while (File.Exists(wsp.Path));

                    if (wsp.Save())
                    {
                        //显示提示
                        string tip = StringResources.GetValue("tip_new_file_be_saved");
                        tip = String.Format(tip, wsp.Path);
                        MessageBox.Show(tip);
                        this.Text = FROM_TITLE + filename;

                        //显示管理图片窗口
                        imageToolStripMenuItem_Click(null, null);
                        wsp.Save();
                    }
                }
            }
        }
Exemple #13
0
        DialogResult alter_and_save()
        {
            DialogResult result = MessageBox.Show(
                StringResources.GetValue("save_question"),
                "save",
                MessageBoxButtons.YesNoCancel);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                return(save_file(false));
            }

            return(result);
        }
Exemple #14
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //Group
            string inputText = textBoxGroup.Text;

            if (inputText.Trim() == "")
            {
                MessageBox.Show(StringResources.GetValue("tip_setting_group"));
                return;
            }

            string[]      strs    = inputText.Split(new char[] { '\r' }, StringSplitOptions.RemoveEmptyEntries);
            List <string> tmpList = new List <string>();

            for (int i = 0; i < strs.Length; i++)
            {
                strs[i] = strs[i].Trim();
                if (strs[i] != "")
                {
                    tmpList.Add(strs[i]);
                }
            }

            if (strs.Length > 9)
            {
                MessageBox.Show(StringResources.GetValue("tip_setting_group"));
                return;
            }

            wsp.Store.GroupList = tmpList;



            //Comment
            foreach (string line in textBoxComment.Lines)
            {
                if (line == "-")
                {
                    MessageBox.Show(StringResources.GetValue("tip_setting_comment"));
                    return;
                }
            }
            wsp.Store.Comment = textBoxComment.Text;


            this.Close();
        }
Exemple #15
0
        static void Main()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            StringResources.SetValue("lang", Language.ReadDefaultLanguage());
            Language.InitStringResouce(StringResources.GetValue("lang"));

            //try{
            //    loadPsScript("ps_blank_layer");
            //    loadPsScript("ps_close_file");
            //    loadPsScript("ps_file_footer");
            //    loadPsScript("ps_file_header");
            //    loadPsScript("ps_header");
            //    loadPsScript("ps_labelnum");
            //    loadPsScript("ps_labeltext");
            //    loadPsScript("ps_add_group");
            //    loadPsScript("ps_run_action");
            //    loadPsScript("ps_del_group_sign");
            //}
            //catch(Exception e)
            //{
            //    MessageBox.Show("PS_Script Definition Error. \r\n"+ e.ToString());
            //    Environment.Exit(1);
            //}


            try{
                GlobalVar.Reload();
            }
            catch (Exception e) {
                MessageBox.Show("Read \"labelplus_config.xml\" Error! \r\n" + e.ToString());
                Environment.Exit(1);
            }

            Application.Run(new MainFrm());
        }
Exemple #16
0
        void doOutput()
        {
            string log = "";

            Invoke(new Action(() => outPgBar.Maximum = wsp.Store.Filenames.Length));

            try
            {
                foreach (string key in wsp.Store.Filenames)
                {
                    if (checkBoxJumpNoNum.Checked && wsp.Store[key].Count == 0)
                    {
                    }
                    else
                    {
                        string outputFilename = folderBrowserDialog.SelectedPath + @"\" + key;
                        outputFilename = replaceExtension(outputFilename, radioButtonPNG.Checked ? ".png" : ".jpg");

                        string inputFilename = wsp.DirPath + @"\" + key;
                        try
                        {
                            Image in_img  = Image.FromFile(inputFilename);
                            Image out_img = null;
                            var   rslt    = pv.MakeImage(ref out_img, ref in_img, Convert.ToSingle(textBox.Text), wsp.Store[key]);
                            in_img.Dispose();
                            if (!rslt)
                            {
                                throw new FormatException();
                            }
                            else
                            {
                                using (Stream stream = new FileStream(outputFilename, FileMode.Create))
                                {
                                    out_img.Save(stream, radioButtonPNG.Checked ? ImageFormat.Png : ImageFormat.Jpeg);
                                    out_img.Dispose();
                                }
                                //stream.Close();
                            }
                        }
                        catch
                        { log += "\n" + StringResources.GetValue("can_not_output_file") + outputFilename; }
                    }
                    Invoke(new Action(() => ++ outPgBar.Value));
                }
                log += "\n\n" + StringResources.GetValue("output_complete");
            }
            catch (ThreadAbortException)
            { log += "\n\n" + StringResources.GetValue("output_aborted"); }
            catch (Exception)
            { log += "\n\n" + StringResources.GetValue("output_fail"); }
            finally
            {
                try
                {
                    MessageBox.Show(log);
                    Invoke(new Action(() => { if (button != null)
                                              {
                                                  button.Enabled = true;
                                              }
                                      }));
                    Invoke(new Action(() => { if (buttonAbort != null)
                                              {
                                                  buttonAbort.Enabled = false;
                                              }
                                      }));
                    Invoke(new Action(() => { if (outPgBar != null)
                                              {
                                                  outPgBar.Value = 0;
                                              }
                                      }));
                }
                catch { /* 窗口销毁后发生的线程冲突之 InvalidOperationException 强行不要了,嗯 */ }
            }
        }
Exemple #17
0
 public ManageImageFrm(Workspace wsp)
 {
     this.wsp = wsp;
     InitializeComponent();
     Language.InitFormLanguage(this, StringResources.GetValue("lang"));
 }
Exemple #18
0
        //
        // 从文本中 获取首部区块
        //
        private void readLabelFileStartBlocks(string nowText)
        {
            //老版本 无start blocks 特殊处理
            if (nowText.Trim() == "")
            {
                //block1
                for (int i = 0; i < FILEHEAD_LENGHT; i++)
                {
                    fileHead[i] = FILEHEAD_DEFAULT[i];      //默认值
                }

                //block2
                groupStringList = new List <string>();
                for (int i = 0; i < GlobalVar.DefaultGroupDefineItems.Length; i++)
                {
                    if (GlobalVar.DefaultGroupDefineItems[i].Name != "")
                    {
                        groupStringList.Add(GlobalVar.DefaultGroupDefineItems[i].Name);
                    }
                    else
                    {
                        break;
                    }
                }

                //block end
                comment = GlobalVar.DefaultComment;

                return;
            }

            string[] textBlocks = nowText.Trim().Split('-');
            if (textBlocks.Length < 3)
            {
                throw new Exception(StringResources.GetValue("error_file_startblocks_lost"));
            }

            string[] tmp;
            //区块1 文件头
            tmp = textBlocks[0].Split(',');
            for (int i = 0; i < FILEHEAD_LENGHT; i++)
            {
                if (i < tmp.Length)
                {
                    fileHead[i] = tmp[i].Trim();               //实际值
                }
                else
                {
                    fileHead[i] = FILEHEAD_DEFAULT[i];      //默认值
                }
            }

            //检查版本信息
            if (Convert.ToInt16(fileHead[0]) > MY_FILE_VER_FIRST)
            {
                throw new Exception(StringResources.GetValue("error_file_version_over"));
            }

            //区块2 分组信息
            tmp = textBlocks[1].Trim().Split('\r');
            foreach (string str in tmp)
            {
                string t = str.Trim();
                if (t != "")
                {
                    groupStringList.Add(t);
                }
            }

            //最后区块 用户注释
            comment = textBlocks[textBlocks.Length - 1].Trim();
        }