コード例 #1
0
    public RcpaListBoxMultipleFileField(Button btnAddFiles, Button btnRemoveFiles, Button btnClear, Button btnLoad, Button btnSave,
                                 ListBox lstFiles, String key, OpenFileArgument fileArgument, bool required,
                                 bool validateSelectedItemOnly)
    {
      Childrens.Add(lstFiles);

      listBoxAdaptor = new ItemInfosListBoxAdaptor(lstFiles);

      validator = new ItemInfosValidator(listBoxAdaptor, validateSelectedItemOnly, required, (m => File.Exists(m)), fileArgument.GetFileDescription(), "File not exists : {0}");

      this.fileArgument = fileArgument;

      this.lstFiles = lstFiles;

      ListBoxFileEventHandlers handlers = new ListBoxFileEventHandlers(lstFiles, fileArgument);

      if (btnAddFiles != null)
      {
        btnAddFiles.Text = "Add";
        btnAddFiles.Click += handlers.AddEvent;
        Childrens.Add(btnAddFiles);
      }

      if (btnRemoveFiles != null)
      {
        btnRemoveFiles.Text = "Remove";
        btnRemoveFiles.Click += handlers.RemoveEvent;
        Childrens.Add(btnRemoveFiles);
      }

      if (btnLoad != null)
      {
        btnLoad.Text = "Load";
        btnLoad.Click += handlers.LoadEvent;
        Childrens.Add(btnLoad);
      }

      if (btnSave != null)
      {
        btnSave.Text = "Save";
        btnSave.Click += handlers.SaveEvent;
        Childrens.Add(btnSave);
      }

      Adaptor = new OptionFileItemInfosAdaptor(listBoxAdaptor, key);
    }
コード例 #2
0
ファイル: ListBoxField.cs プロジェクト: shengqh/RCPA.Core
    public ListBoxField()
    {
      InitializeComponent();

      adaptor = new ItemInfosListBoxAdaptor(lbFiles);

      handlers = new ListBoxFileEventHandlers(lbFiles, null);

      btnAdd.Click += handlers.AddEvent;

      btnRemove.Click += handlers.RemoveEvent;

      btnClear.Click += handlers.ClearEvent;

      btnLoad.Click += handlers.LoadEvent;

      btnSave.Click += handlers.SaveEvent;
    }
コード例 #3
0
    public MultipleFileField()
    {
      InitializeComponent();

      adaptor = new ItemInfosListBoxAdaptor(lbFiles);

      handlers = new ListBoxFileEventHandlers(lbFiles, null);

      ValidateSelectedItemOnly = false;

      Required = true;

      Key = "File";

      btnAdd.Click += handlers.AddEvent;

      btnRemove.Click += handlers.RemoveEvent;

      btnClear.Click += handlers.ClearEvent;

      btnLoad.Click += handlers.LoadEvent;

      btnSave.Click += handlers.SaveEvent;
    }