Changeset 9714


Ignore:
Timestamp:
07/17/13 13:35:44 (6 years ago)
Author:
mkommend
Message:

#2081: Integrated new HL path data types from the branch.

Location:
trunk/sources
Files:
1 deleted
7 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3

  • trunk/sources/HeuristicLab.Data.Views/3.3/HeuristicLab.Data.Views-3.3.csproj

    r9379 r9714  
    133133      <DependentUpon>IntRangeView.cs</DependentUpon>
    134134    </Compile>
     135    <Compile Include="Path Views\DirectoryValueView.cs">
     136      <SubType>UserControl</SubType>
     137    </Compile>
     138    <Compile Include="Path Views\DirectoryValueView.Designer.cs">
     139      <DependentUpon>DirectoryValueView.cs</DependentUpon>
     140    </Compile>
     141    <Compile Include="Path Views\FileValueView.cs">
     142      <SubType>UserControl</SubType>
     143    </Compile>
     144    <Compile Include="Path Views\FileValueView.Designer.cs">
     145      <DependentUpon>FileValueView.cs</DependentUpon>
     146    </Compile>
     147    <Compile Include="Path Views\TextFileView.cs">
     148      <SubType>UserControl</SubType>
     149    </Compile>
     150    <Compile Include="Path Views\TextFileView.Designer.cs">
     151      <DependentUpon>TextFileView.cs</DependentUpon>
     152    </Compile>
    135153    <Compile Include="Plugin.cs" />
    136154    <Compile Include="StringConvertibleMatrixColumnVisibilityDialog.cs">
     
    196214  </ItemGroup>
    197215  <ItemGroup>
     216    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
     217      <Project>{0e27a536-1c4a-4624-a65e-dc4f4f23e3e1}</Project>
     218      <Name>HeuristicLab.Common.Resources-3.3</Name>
     219      <Private>False</Private>
     220    </ProjectReference>
    198221    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    199222      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
  • trunk/sources/HeuristicLab.Data.Views/3.3/Path Views/TextFileView.cs

    r9705 r9714  
    2929namespace HeuristicLab.Data.Views {
    3030  [View("TextFileView")]
    31   [Content(typeof(TextFile), true)]
    32   public partial class TextFileView : ItemView {
     31  [Content(typeof(TextFileValue), true)]
     32  public sealed partial class TextFileView : ItemView {
    3333    private bool changedFileContent;
    34     protected bool ChangedFileContent {
     34    private bool ChangedFileContent {
    3535      get { return changedFileContent; }
    3636      set {
     
    4242    }
    4343
    44     public new TextFile Content {
    45       get { return (TextFile)base.Content; }
     44    public new TextFileValue Content {
     45      get { return (TextFileValue)base.Content; }
    4646      set { base.Content = value; }
    4747    }
     
    9797    }
    9898
    99     protected virtual void Content_FilePathChanged(object sender, EventArgs e) {
     99    private void Content_FilePathChanged(object sender, EventArgs e) {
    100100      UpdateTextBox();
    101101      SetEnabledStateOfControls();
    102102    }
    103     protected virtual void Content_FileDialogFilterChanged(object sender, EventArgs e) {
     103    private void Content_FileDialogFilterChanged(object sender, EventArgs e) {
    104104      saveFileDialog.Filter = Content.FileDialogFilter;
    105105    }
    106106
    107     protected virtual void textBox_TextChanged(object sender, EventArgs e) {
     107    private void textBox_TextChanged(object sender, EventArgs e) {
    108108      ChangedFileContent = fileText != textBox.Text;
    109109    }
    110110
    111     protected virtual void OnChangedFileContent() {
     111    private void OnChangedFileContent() {
    112112      SetEnabledStateOfControls();
    113113      if (ChangedFileContent) {
     
    118118    }
    119119
    120     protected bool fileSystemWatcherChangedFired = false;
    121     protected virtual void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e) {
     120    private bool fileSystemWatcherChangedFired = false;
     121    private void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e) {
    122122      //mkommend: cannot react on visible changed, because this event is not fired when the parent control gets visible set to false
    123123      if (!Visible) return;
     
    162162    }
    163163
    164     protected virtual void fileSystemWatcher_Renamed(object sender, RenamedEventArgs e) {
     164    private void fileSystemWatcher_Renamed(object sender, RenamedEventArgs e) {
    165165      //mkommend: cannot react on visible changed, because this event is not fired when the parent control gets visible set to false
    166166      if (!Visible) return;
     
    174174    }
    175175
    176     protected virtual void SaveFile() {
     176    private void SaveFile() {
    177177      //omit circular events by changing the file from HL
    178178      fileSystemWatcher.EnableRaisingEvents = false;
     
    189189    }
    190190
    191     protected virtual void saveButton_Click(object sender, EventArgs e) {
     191    private void saveButton_Click(object sender, EventArgs e) {
    192192      SaveFile();
    193193    }
    194194
    195     protected string fileText;
    196     protected virtual void UpdateTextBox() {
     195    private string fileText;
     196    private void UpdateTextBox() {
    197197      if (string.IsNullOrEmpty(Content.Value)) {
    198198        textBox.Enabled = false;
     
    201201      }
    202202
    203       fileText = ReadFile(Content.Value) ?? string.Empty;
    204       if (string.IsNullOrEmpty(fileText)) {
     203      fileText = ReadFile(Content.Value);
     204      if (fileText == null) {
    205205        textBox.Enabled = false;
    206206        textBox.Text = string.Format("The specified file \"{0}\" cannot be found.", Content.Value);
     
    211211      textBox.Text = fileText;
    212212    }
    213     protected virtual void textBox_Validated(object sender, EventArgs e) {
     213    private void textBox_Validated(object sender, EventArgs e) {
    214214      if (!ChangedFileContent) return;
    215215      string msg = string.Format("You have not saved the changes in the file \"{0}\" yet. Do you want to save the changes?", Content.Value);
     
    226226    }
    227227
    228     public static string ReadFile(string path) {
     228    private static string ReadFile(string path) {
    229229      if (!File.Exists(path)) return null;
    230       string fileContent;
     230      string fileContent = string.Empty;
    231231      using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) {
    232232        using (StreamReader streamReader = new StreamReader(fileStream)) {
     
    237237    }
    238238
    239     public static void WriteFile(string path, string fileContent) {
     239    private static void WriteFile(string path, string fileContent) {
    240240      using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Write)) {
    241241        using (StreamWriter streamWriter = new StreamWriter(fileStream)) {
  • trunk/sources/HeuristicLab.Data.Views/3.3/Plugin.cs.frame

    r9462 r9714  
    3232  [PluginFile("HeuristicLab.Data.Views-3.3.dll", PluginFileType.Assembly)]
    3333  [PluginDependency("HeuristicLab.Common", "3.3")]
     34  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
    3435  [PluginDependency("HeuristicLab.Core", "3.3")]
    3536  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs

    r9695 r9714  
    125125        Invoke(new EventHandler<EventArgs<int>>(Content_ItemChanged), sender, e);
    126126      else {
     127        // if a resize of the array occurs and some other class handles the event and provides default values
     128        //then the itemChanged will occur before the reset event. hence the check was added
     129        if (dataGridView.RowCount <= e.Value) return;
    127130        dataGridView.Rows[e.Value].Cells[0].Value = Content.GetValue(e.Value);
    128131        Size size = dataGridView.Rows[e.Value].Cells[0].PreferredSize;
  • trunk/sources/HeuristicLab.Data/3.3

  • trunk/sources/HeuristicLab.Data/3.3/HeuristicLab.Data-3.3.csproj

    r8600 r9714  
    117117    <Compile Include="Comparison.cs" />
    118118    <Compile Include="ComparisonType.cs" />
     119    <Compile Include="Path Types\DirectoryValue.cs" />
     120    <Compile Include="Path Types\FileValue.cs" />
     121    <Compile Include="Path Types\PathValue.cs" />
     122    <Compile Include="Path Types\TextFileValue.cs" />
    119123    <Compile Include="PercentMatrix.cs" />
    120124    <Compile Include="PercentArray.cs" />
     
    212216  -->
    213217  <PropertyGroup>
    214    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     218    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    215219set ProjectDir=$(ProjectDir)
    216220set SolutionDir=$(SolutionDir)
     
    219223call PreBuildEvent.cmd
    220224</PreBuildEvent>
    221 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     225    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
    222226export ProjectDir=$(ProjectDir)
    223227export SolutionDir=$(SolutionDir)
  • trunk/sources/HeuristicLab.Data/3.3/Path Types/TextFileValue.cs

    r9706 r9714  
    2727  [Item("TextFile", "Represents the content and path to a text file.")]
    2828  [StorableClass]
    29   public class TextFile : FileValue {
     29  public class TextFileValue : FileValue {
    3030    [StorableConstructor]
    31     protected TextFile(bool deserializing) : base(deserializing) { }
    32     protected TextFile(TextFile original, Cloner cloner)
     31    protected TextFileValue(bool deserializing) : base(deserializing) { }
     32    protected TextFileValue(TextFileValue original, Cloner cloner)
    3333      : base(original, cloner) {
    3434    }
    3535    public override IDeepCloneable Clone(Cloner cloner) {
    36       return new TextFile(this, cloner);
     36      return new TextFileValue(this, cloner);
    3737    }
    3838
    39     public TextFile()
     39    public TextFileValue()
    4040      : base() {
    4141    }
Note: See TracChangeset for help on using the changeset viewer.