Esempio n. 1
0
        public void SetSelceted(FileTypeInfo info)
        {
            string newFileName = this.GetNewFileName(info.Name, this.parentDir, info.Extension);

            this.entry_FileName.Text = newFileName;
            int length = newFileName.Length;

            this.entry_FileName.SelectRegion(0, length);
            this.entry_FileName.HasFocus = true;
            this.JudgeView(info.FileType);
        }
Esempio n. 2
0
 private void SetWigetPropeties(FileTypeInfo item, int cloum, FileTypeItem fileItem = null)
 {
     fileItem = (fileItem ?? new FileTypeItem());
     if (cloum == 0)
     {
         this.selectedItem = fileItem;
         this.SetSelceted(item);
         fileItem.Selected();
     }
     else
     {
         fileItem.UnSelected();
     }
     fileItem.ButtonReleaseEvent += new ButtonReleaseEventHandler(this.fileItem_ButtonReleaseEvent);
     fileItem.InitiaView(item);
     this.hb_FileType.Add(fileItem);
     Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild) this.hb_FileType[fileItem];
     boxChild.Position = cloum;
     boxChild.Expand   = false;
     boxChild.Fill     = false;
 }
Esempio n. 3
0
 public void InitiaView(FileTypeInfo info)
 {
     this.fileTypeInfo = info;
     this.img_Icon.SetImageView(info.Icon);
     this.lab_Name.LabelProp = info.DisplayName;
 }
Esempio n. 4
0
 public NewFileEventArgs(string fileName, FileTypeInfo info)
 {
     this.FileName     = fileName;
     this.FileTypeInfo = info;
 }
Esempio n. 5
0
        private void btnNew_Clicked(object sender, EventArgs e)
        {
            this.result = new FileDialogResult();
            FileTypeInfo fileTypeInfo = this.selectedItem.FileTypeInfo;
            double       value        = this.entryHeight.Value;
            double       value2       = this.entryWidth.Value;

            Xwt.Size size = new Xwt.Size(value2, value);
            if (RegexModel.IsHasSystemReserveName(this.entry_FileName.Text))
            {
                MessageBox.Show(LanguageInfo.MessageBox215_WindowsNameLimit, this, null, MessageBoxImage.Info);
                this.entry_FileName.SelectRegion(0, this.entry_FileName.Text.Length);
                this.entry_FileName.HasFocus = true;
                this.result.IsSuccessful     = false;
            }
            else
            {
                string text = this.entry_FileName.Text + fileTypeInfo.Extension;
                if (!Regex.IsMatch(text, "^[A-Za-z0-9,._-]+$") || Regex.IsMatch(text, "[\\*\\\\/:?<>|\"]"))
                {
                    MessageBox.Show(LanguageInfo.MessageBox216_FileNameLimit, this, null, MessageBoxImage.Info);
                    this.entry_FileName.SelectRegion(0, this.entry_FileName.Text.Length);
                    this.entry_FileName.HasFocus = true;
                    this.result.IsSuccessful     = false;
                }
                else if (!FileService.IsValidFileName(text))
                {
                    string info = LanguageInfo.NewFile_WrongName.Replace("<", "&lt;").Replace(">", "&gt;");
                    MessageBox.Show(info, this, null, MessageBoxImage.Info);
                    this.entry_FileName.SelectRegion(0, this.entry_FileName.Text.Length);
                    this.entry_FileName.HasFocus = true;
                    this.result.IsSuccessful     = false;
                }
                else
                {
                    string value3 = text.Substring(0, text.Length - fileTypeInfo.Extension.Length);
                    if (string.IsNullOrWhiteSpace(value3))
                    {
                        MessageBox.Show(LanguageInfo.MessageBox_Content110, this, null, MessageBoxImage.Info);
                        this.entry_FileName.HasFocus = true;
                        this.result.IsSuccessful     = false;
                    }
                    else
                    {
                        this.result.FileName = text;
                        this.result.Size     = size;
                        this.result.FileType = this.selectedItem.FileTypeInfo.FileType;
                        string path = System.IO.Path.Combine(this.parentDir, this.result.FileName);
                        if (File.Exists(path))
                        {
                            MessageBox.Show(LanguageInfo.NewFile_SameName, this, null, MessageBoxImage.Info);
                            this.entry_FileName.SelectRegion(0, this.entry_FileName.Text.Length);
                            this.entry_FileName.HasFocus = true;
                            this.result.IsSuccessful     = false;
                        }
                        else
                        {
                            this.Destroy();
                            this.Dispose();
                        }
                    }
                }
            }
        }