Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Jul 29, 2020
1 parent a556e71 commit 402b0f4
Show file tree
Hide file tree
Showing 48 changed files with 8,204 additions and 5,263 deletions.
92 changes: 46 additions & 46 deletions Crystallography.Controls/CommonDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ namespace Crystallography.Controls
{
public partial class CommonDialog : Form
{
#region プロパティ,フィールド

public (string Text, double Ratio) Progress
{
set
{
Text = value.Text;
var progress = (int)(progressBar.Maximum * value.Ratio);
progressBar.Value = progress < progressBar.Maximum ? progress : progressBar.Maximum ;
Application.DoEvents();
}
}

public enum DialogModeEnum { Initialize, History, License, Hint }

public DialogModeEnum DialogMode
Expand All @@ -16,7 +29,6 @@ public DialogModeEnum DialogMode
flowLayoutPanelSoftwareInformation.Visible = true;
if (value == DialogModeEnum.Initialize)
{

progressBar.Visible = true;
checkBoxCloseWindow.Visible = true;

Expand Down Expand Up @@ -56,17 +68,9 @@ public DialogModeEnum DialogMode
Size = new Size(400, 200);
}
}

}

public CommonDialog()
{
InitializeComponent();
}


private string software="";// e.g., "ReciPro" 

public string Software
{
get => software;
Expand All @@ -93,31 +97,45 @@ public string VersionAndDate

public string History { get; set; } = "";


public string[] Hint { set { hint = value; setToolTips(); } get => hint; }
private string[] hint;

public string[] Hint
{
set
{
hint = value;
setToolTips();
}
get => hint;
}
public bool AutomaricallyClose { set => checkBoxCloseWindow.Checked = value; get => checkBoxCloseWindow.Checked; }

private int currentHintIndex = 0;

/// <summary>
/// License
/// </summary>
static public string License =
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation" +
" files(the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy," +
" modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software" +
" is furnished to do so, subject to the following conditions:\r\n\r\n" +
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r\n\r\n" +
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES" +
" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE " +
"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN " +
"CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.";


#endregion

private void setToolTips()
#region コンストラクタ、ロード、クローズ

public CommonDialog()
{
textBox.Text = hint.Length > 0 ? hint[new Random().Next(hint.Length)]: "";
InitializeComponent();
}

public bool AutomaricallyClose
private void CommonDialog_FormClosing(object sender, FormClosingEventArgs e)
{
set => checkBoxCloseWindow.Checked = value;
get => checkBoxCloseWindow.Checked;
e.Cancel = true;
Visible = false;
}

private int currentHintIndex = 0;
#endregion

#region ボタンイベント

private void buttonOK_Click(object sender, EventArgs e)
{
Expand All @@ -134,26 +152,8 @@ private void buttonNext_Click(object sender, EventArgs e)
textBox.Text = hint[currentHintIndex];
}
}
#endregion


/// <summary>
/// License
/// </summary>
static public string License =
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation" +
" files(the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy," +
" modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software" +
" is furnished to do so, subject to the following conditions:\r\n\r\n" +
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r\n\r\n" +
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES" +
" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE " +
"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN " +
"CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.";

private void CommonDialog_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
Visible = false;
}
private void setToolTips() => textBox.Text = hint.Length > 0 ? hint[new Random().Next(hint.Length)] : "";
}
}
Loading

0 comments on commit 402b0f4

Please sign in to comment.