tag:blogger.com,1999:blog-77575642261772936462024-03-08T12:33:54.033+01:00Code Example CenterMicrosoft AX 2012, X++, C#, SQL server, SSRS, Java, JavaFX, Oracle, PL/SQL, Delphi - codes examples, step-by-step tutorials, experiences.Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.comBlogger351125tag:blogger.com,1999:blog-7757564226177293646.post-83257809387014489062024-01-16T09:47:00.001+01:002024-01-16T09:47:23.845+01:00c# - How to use LINQ aggregate() functionThis calling performs SUM on Population (with starting value = 0.)
<pre class="code">
public List<Country> Countries = new();
...
this.Countries.Add( new Country( "Czech", Country.ContinentEnum.EUROPE, 10 ) );
this.Countries.Add( new Country( "Poland", Country.ContinentEnum.EUROPE, 40 ) );
this.Countries.Add( new Country( "China", Country.ContinentEnum.ASIA, 1100 ) );
this.Countries.Add( new Country( "USA", Country.ContinentEnum.AMERICA, 340 ) );
...
int total = this.Countries.Aggregate( 0, (total,b) => total + b.Population );
MessageBox.Show( total.ToString() ); // -> 1490
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-69037033037611574472023-11-30T12:11:00.002+01:002023-11-30T12:11:27.052+01:00c# - How to call custom event1) Custom event without parameters:
<pre class="code">
public Action OnBeforeEvaluationEvent;
...
if ( OnBeforeEvaluationEvent != null ) OnBeforeEvaluationEvent();
</pre>
2) Custom event with parameter(s):
<pre class="code">
public delegate void OnAfterEvaluatingDelegate( CodeConditionGroup _conditionGroup );
public event OnAfterEvaluatingDelegate OnAfterEvaluationgEvent;
if ( OnAfterEvaluationgEvent != null ) OnAfterEvaluationgEvent( condition );
</pre>
Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-5895617024684585612023-11-24T09:48:00.000+01:002023-11-24T09:48:35.914+01:00c#, devexpress - How to make master-detail relation on non-DB objects (List generic ) <pre class="code">List<TmpParent> list = new List<TmpParent>();
List<TmpChild> listChildExternal = new List<TmpChild>();
</pre>
Initial data filling:
<pre class="code">var p = new TmpParent( "A", "A", true );
p.listInner.Add( new TmpChild() );
list.Add( p );
list.Add( new TmpParent( "B", "B", false, TypeEnum.OPERATOR ) );
list.Add( new TmpParent( "C", "C", true ) );
list.Add( new TmpParent( "D", "D", false ) );
listChildExternal.Add( new TmpChild() { str1="C", str2 = "child1" } );
listChildExternal.Add( new TmpChild() { str1="C", str2 = "child1.1" } );
listChildExternal.Add( new TmpChild() { str1="B", str2 = "child1.2" } );
gridParent.DataSource = list; // master
</pre>
Find and show detail data:
<div><ul style="text-align: left;"><li>First detail list for inner list.</li><li>Second detail list for external list connected with relation.</li></ul></div>
<pre class="code">private void gridViewParent_FocusedRowChanged( object sender,
DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e ) {
if ( e.FocusedRowHandle >= 0 ) {
TmpParent master = gridView1.GetRow( e.FocusedRowHandle ) as TmpParent;
if ( master != null ) {
/* A] try to find in inner list */
gridDetail.DataSource = master.listInner;
/* B] try to find in external list */
gridChildExternal.DataSource =
listChildExternal.Where( x => x.str1 == master.str1 ).ToList();
}
}
}
</pre>
First grid=master, second grid=detail internal list, third grid=detail external list.
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm50rg5LkCQvOWELPKfn6UVrsMncFOJjGKYiAxjMKqfU-PC3gvau32_DjLiQ2G9gLo8Gz3L1OxXmdzvBcytd8vNaE527rOicNupuP8hCit_TIYKMDNwDBNt6rPvFb7UoVWw8gTfcLEokvaOkhZux5s2XNiYQsVP-0NZ8RogrzTAtPhhoqKSxY5TrLBfnY/s696/grid.png" style="clear: left; display: block; float: left; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="509" data-original-width="696" height="469" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm50rg5LkCQvOWELPKfn6UVrsMncFOJjGKYiAxjMKqfU-PC3gvau32_DjLiQ2G9gLo8Gz3L1OxXmdzvBcytd8vNaE527rOicNupuP8hCit_TIYKMDNwDBNt6rPvFb7UoVWw8gTfcLEokvaOkhZux5s2XNiYQsVP-0NZ8RogrzTAtPhhoqKSxY5TrLBfnY/w640-h469/grid.png" width="640" /></a></div>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-80556871080811321812023-11-14T10:31:00.004+01:002023-11-22T06:30:42.596+01:00c#, devexpress - How to use attributes in GridControl (devexpress)The attributes in the class can be used as metadata for generated <b>GridControl (devexpress)</b> columns. <div><br /></div><div>Class for rows:
<pre class="code">public enum TypeEnum {
<span style="background-color: #f1c232;">[Display(Name = "Type is expression.")]</span>
EXPRESSION = 0,
<span style="background-color: #f1c232;">[Display(Name = "Type is operator.")]</span>
OPERATOR = 1
}
public class TmpParent
{
<span style="background-color: #f1c232;">[Display(
ShortName = "Company",
Name = "Company Name",
Description = "The amount of currently available product",
AutoGenerateFilter = false)
]</span>
public string str1 { get; set; }
<span style="background-color: #f1c232;">[DataType(DataType.Text), StringLength(20, MinimumLength = 3)]</span>
public string str2 { get; set; }
public bool bool1 { get; set; }
public TypeEnum enum1 { get; set; }
<span style="background-color: #f1c232;">[DisplayFormat(DataFormatString = "MMMM/yyyy")]</span>
public DateTime date1 { get; set; }
<span style="background-color: #f1c232;">[DisplayFormat(DataFormatString = "p", ApplyFormatInEditMode = true)]</span>
public float value1 { get; set; }
<span style="background-color: #f1c232;">[DataType(DataType.Currency), Range(200, 5000), Required] </span>
public float value2 { get; set; }
public TmpParent( string _s1, string _s2, bool _b, TypeEnum _enum = TypeEnum.EXPRESSION )
{
str1 = _s1;
str2 = _s2;
bool1 = _b;
enum1 = _enum;
date1 = DateTime.Now;
value1 = 100.1f;
value2 = 300.5f;
}
}
</pre>
Grid fillings:
<pre class="code">var p = new TmpParent( "A", "A", true );
list.Add( p );
list.Add( new TmpParent( "B", "B", false, TypeEnum.OPERATOR ) );
list.Add( new TmpParent( "C", "C", true ) );
list.Add( new TmpParent( "D", "D", false ) );
gridParent.DataSource = list;
</pre>
Output:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCVdDBQQf_LORRuma7tDME4FvGilNtjM0tMWpKZ637Dq-DZpoPs2HoSx3tWLQUh843kJoLbAdj7n3jsGOfzcq2RPRO_ZCDZKM-YACYuLHMSMk8ZyKthrftdMFsHH5HUD_Esjx0TYQtalHGsRR_7F-_mD9cxIS2ZnCmlYbPg0wE352qbrAoDZDa2Zl-CoE/s703/cxgrid.png" style="clear: left; display: block; float: left; margin-bottom: 1em; margin-right: 1em; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="196" data-original-width="703" height="178" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCVdDBQQf_LORRuma7tDME4FvGilNtjM0tMWpKZ637Dq-DZpoPs2HoSx3tWLQUh843kJoLbAdj7n3jsGOfzcq2RPRO_ZCDZKM-YACYuLHMSMk8ZyKthrftdMFsHH5HUD_Esjx0TYQtalHGsRR_7F-_mD9cxIS2ZnCmlYbPg0wE352qbrAoDZDa2Zl-CoE/w640-h178/cxgrid.png" width="640" /></a></div></div>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-3001443485682161052023-10-23T08:09:00.002+02:002023-10-23T08:10:26.339+02:00delphi - How to work with generic TArrayUsing generic <b>TArray</b> with <b>String</b> type.
<pre class="code">procedure TFDrawingRelease.doReading;
var
f : TextFile;
sRow : string;
<span style="background-color: #ffd966;">aSplitted: TArray<string></span>;
begin
<span style="color: #38761d;">{ -- delete all rows }
</span>
if QData.Active then
begin
QData.Close;
QData.Open;
end;
<span style="color: #38761d;">{ -- open file and read data (two columns divided by ";") }</span>
AssignFile( f, EFileName.Text );
try
Screen.Cursor := crHourGlass;
QData.DisableControls;
reset( f );
while not eof( f ) do
begin
readln( f, sRow );
<span style="background-color: #ffd966;">aSplitted := sRow.Split( [';'], 2 );</span>
QData.Insert;
<span style="color: #38761d;">{ ..and return to first char _ }</span>
QDataItemid.AsString := aSplitted[0].Split( [ '_' ], 1 )[0];
QDataName.AsString := aSplitted[1];
QData.Post;
end;
finally
closeFile( f );
QData.EnableControls;
Screen.Cursor := crDefault;
end;
SetButtons;
end;
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-68272261734628355682023-09-06T08:59:00.002+02:002023-09-06T09:00:22.995+02:00ax - How to call new form and modify its grid filter<pre class="code">Args args;
FormRun formRun;
Query query;
My_VM_Resources table;
FormDataSource formDataSource = new FormDataSource();
super();
<span style="color: #6aa84f;">// call the new form </span>
args = new Args();
formRun = new menufunction( menuItemDisplayStr( WrkCtrCapRes ),
MenuItemType::Display ).create( args );
formRun.init();
formDataSource = formRun.dataSource();
formRun.run();
table = My_VM_Resources_ds.cursor();
<span style="background-color: #f1c232;">formDataSource.filter( fieldNum(WrkCtrCapRes, WrkCtrId), /*"5210*"*/table.my_resource_mask );</span>
formRun.detach();
formRun.wait();
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-12934453273769891502023-08-30T10:18:00.001+02:002023-08-30T10:18:18.778+02:00android - How to speed up android emulatorTry to activate this features.
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8hG3BAHhsFuWSYWo1ENo5XOAh6AnU_h7OSD-h7BQRjde3xrh5Gu27bFmviL-wYEVlis65pni_fRBpd4VRXcuXPZruteXUUzpYc0m3HSeKRiut4HeHDJCBZqkQD-T3ZzU-ChBIsBJP6rvCbzLw3wKcASc2BZcAWX21-1XuZ0wC-F52Ky6r72jBsuGRdYc/s451/windows-features.png" style="clear: left; display: block; float: left; margin-bottom: 1em; margin-right: 1em; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="446" data-original-width="451" height="395" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8hG3BAHhsFuWSYWo1ENo5XOAh6AnU_h7OSD-h7BQRjde3xrh5Gu27bFmviL-wYEVlis65pni_fRBpd4VRXcuXPZruteXUUzpYc0m3HSeKRiut4HeHDJCBZqkQD-T3ZzU-ChBIsBJP6rvCbzLw3wKcASc2BZcAWX21-1XuZ0wC-F52Ky6r72jBsuGRdYc/w400-h395/windows-features.png" width="400" /></a></div>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-46794843585315946782023-07-12T05:59:00.007+02:002023-07-12T05:59:52.261+02:00c# - LINQ max() and empty list - how to solve<pre class="code">
int iMaxLevel = this.Items.Any() ? this.Items.Max( x => x.Level ) : 0;
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-69858185468045372292023-05-22T05:08:00.001+02:002023-05-22T05:08:32.696+02:00oracle - How to alter sequence next number<pre class="code">DROP SEQUENCE MENU_SEQ;
create sequence MENU_SEQ
minvalue 1
maxvalue 999999999999999999999
<span style="background-color: #f1c232;">start with 18456</span>
increment by 1
cache 20;
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-84552000440203769902023-04-21T08:34:00.002+02:002023-10-23T08:10:15.267+02:00ax - How to find plan version by name<pre class="code">if ( this.RefType == WrkCtrCapRefType::PlannedOrder ) {
reqPO = ReqPO::find(
<span style="background-color: #f6b26b;">ReqPlanVersion::findReqPlanId( "MAIN", "company", NoYes::Yes, false ).RecId</span>,
this.refId, false );
if ( reqPO ) return reqPO.ItemId;
}
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-31071771460517345172023-04-14T12:41:00.000+02:002023-04-14T12:41:04.757+02:00c# - How to solve problem on TEST project with error on referenced projectThe problem with the referenced project error can be solved with this change: <div><br /></div><div> Set "<i>Target OS</i>" from "<i>None</i>" to something else.<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjXg0XXTdgEn3zYs8LYdprhcUBmKyfuToeodh1Is6NN9ZWci3DYPSlBsWQN-KutUutbyLO27VNGh7erTqtsXoZpMwXARJgmFpiJS9ZSPu-Sqj04XPenK-2kzcAp5x8th4xPO703WzRD7qCmtfyHx5Ym_qehANQGq53WuQQUG5xMiAUNmPSHvBmxqjT/s518/c9.png" style="clear: left; display: block; float: left; margin-bottom: 1em; margin-right: 1em; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="470" data-original-width="518" height="363" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjXg0XXTdgEn3zYs8LYdprhcUBmKyfuToeodh1Is6NN9ZWci3DYPSlBsWQN-KutUutbyLO27VNGh7erTqtsXoZpMwXARJgmFpiJS9ZSPu-Sqj04XPenK-2kzcAp5x8th4xPO703WzRD7qCmtfyHx5Ym_qehANQGq53WuQQUG5xMiAUNmPSHvBmxqjT/w400-h363/c9.png" width="400" /></a></div></div>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-45646366582305858522023-02-16T05:47:00.005+01:002023-02-16T05:47:47.646+01:00win os - How to list users connected to remote serverWith this command:
<pre class="code">quser
</pre>
Output:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimvDdJprjfT02ROvqB4QBw6zXjAxzR7wuMk4iwKpqmio8tRRtUxj1FHnS8MqlCFXrNt0Qmv14WYIPGWSe7ICmGE7ZhI1jHpBVYdDQr2byOzpKFGblLmuxGsMxlWEItjXZHiJbL09eTM0ucb7fXKWqIn2O0V3nEooiIO0eo5MP2iXoulsliBw6FTScH/s605/quser.png" style="clear: left; display: block; float: left; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="333" data-original-width="605" height="352" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimvDdJprjfT02ROvqB4QBw6zXjAxzR7wuMk4iwKpqmio8tRRtUxj1FHnS8MqlCFXrNt0Qmv14WYIPGWSe7ICmGE7ZhI1jHpBVYdDQr2byOzpKFGblLmuxGsMxlWEItjXZHiJbL09eTM0ucb7fXKWqIn2O0V3nEooiIO0eo5MP2iXoulsliBw6FTScH/w640-h352/quser.png" width="640" /></a></div>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-55044855972397549962023-01-30T12:50:00.003+01:002023-01-30T12:50:37.034+01:00c# - How to save List into text file<pre class="code">
public List<string> CodeLogOnlyList = new();
...
await System.IO.File.WriteAllLinesAsync( _filename, this.CodeLogOnlyList );
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-50034334730307123132023-01-20T07:43:00.000+01:002023-01-20T07:43:06.731+01:00c# - How to access to parent form (for form)<pre class="code">
itemWebLink.Web.KeyDown += ((FMain)this.ParentForm).Web_KeyDown;
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-66149313658172376942023-01-20T07:29:00.005+01:002023-01-20T07:37:35.779+01:00c# - How applicate LINQ WHERE and FOREACH<pre class="code">
this.ConditionGroups.Where( x => x.Active == true ).ToList().ForEach( condition => {
...
} );Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-66854546080714882272023-01-11T10:32:00.002+01:002023-01-11T10:33:41.638+01:00sql server - How to call exec proc and show its result<pre class="code">
declare @i int;
exec @i = users_exists 'worker01';
print @i;
</pre>
Output:
<pre class="output">
0
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-10096497048281616692022-11-17T11:54:00.001+01:002022-11-17T11:54:26.032+01:00sql server - How to count only rows where are non-zero valueIn SELECT use this construction with CASE statement:
<pre class="code">
...
count(*) as rowscount,
sum( case a.costamount when 0 then 0 else 1 end ) as rowscount_nonzero
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-204525336312174282022-10-20T09:20:00.003+02:002022-10-20T09:20:39.627+02:00Visual Studio - How to disable expand/collapse in editor ?All these checkboxes to false.
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmjoLtQRs4vBV3hYCs9zp4aKSkCaLxTSQofkdSwZtSEgxJjY6WeFlse2B76CpbNYuxsDhm7qtZd9ICUcTlZ4ujteIAbEv2cVnBbo-fe5ko3FkEJKgtgJk0YZMrPVNdkCZPOXJh_XmdPSCwjNrXDQQ7aoG8KmPwsEcGZp-1-oYs_GfLqipcwktLyu_B/s744/vs1.png" style="clear: left; display: block; float: left; margin-bottom: 1em; margin-right: 1em; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="668" data-original-width="744" height="574" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmjoLtQRs4vBV3hYCs9zp4aKSkCaLxTSQofkdSwZtSEgxJjY6WeFlse2B76CpbNYuxsDhm7qtZd9ICUcTlZ4ujteIAbEv2cVnBbo-fe5ko3FkEJKgtgJk0YZMrPVNdkCZPOXJh_XmdPSCwjNrXDQQ7aoG8KmPwsEcGZp-1-oYs_GfLqipcwktLyu_B/w640-h574/vs1.png" width="640" /></a></div>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-91503987960631164152022-07-22T07:58:00.002+02:002022-07-22T07:58:34.147+02:00c# - How convert string array into one stringIf you use this code on string array:
<pre class="code">string[] args = Environment.GetCommandLineArgs();
Console.Write( args.ToString() );
</pre>
you will get:
<pre class="output">System.String[]
</pre>
But better way in this case is to use string.Join() function (where you can set used delimiter):
<pre class="code">string[] args = Environment.GetCommandLineArgs();
Console.Write( <span style="background-color: #f1c232;">string.Join</span>( ",", args ) );
</pre>
Then:
<pre class="output">C:\app.dll,layoutdir=C:/app/bin
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-12544502117706386802022-06-24T12:29:00.001+02:002022-06-24T12:30:56.564+02:00c# - How get important system informationsSometimes you need for example width of the standard scrollbar. For getting it you can use <b>SystemInformation</b> class (<i>WinForms</i>).
Here is a list of supported properties and their values.
<pre class="code">
Type t = typeof( System.Windows.Forms.SystemInformation );
PropertyInfo[] property = t.GetProperties();
for( int i = 0; i < property.Length; i++ )
richTextBox1.Text += property[ i ].Name + " = " +
property[ i ].GetValue( null, null ).ToString() + "\n";
</pre>
Output:
<pre class="output">
DragFullWindows = True
HighContrast = False
MouseWheelScrollLines = 3
PrimaryMonitorSize = {Width=1920, Height=1080}
VerticalScrollBarWidth = 17
HorizontalScrollBarHeight = 17
CaptionHeight = 23
BorderSize = {Width=1, Height=1}
FixedFrameBorderSize = {Width=3, Height=3}
VerticalScrollBarThumbHeight = 17
HorizontalScrollBarThumbWidth = 17
IconSize = {Width=32, Height=32}
CursorSize = {Width=32, Height=32}
MenuFont = [Font: Name=Segoe UI, Size=12, Units=0, GdiCharSet=1, GdiVerticalFont=False]
MenuHeight = 20
PowerStatus = System.Windows.Forms.PowerStatus
WorkingArea = {X=0,Y=0,Width=1920,Height=1080}
KanjiWindowHeight = 0
MousePresent = True
VerticalScrollBarArrowHeight = 17
HorizontalScrollBarArrowWidth = 17
DebugOS = False
MouseButtonsSwapped = False
MinimumWindowSize = {Width=136, Height=39}
CaptionButtonSize = {Width=36, Height=22}
FrameBorderSize = {Width=4, Height=4}
MinWindowTrackSize = {Width=136, Height=39}
DoubleClickSize = {Width=4, Height=4}
DoubleClickTime = 500
IconSpacingSize = {Width=75, Height=75}
RightAlignedMenus = False
PenWindows = False
DbcsEnabled = False
MouseButtons = 8
Secure = False
Border3DSize = {Width=2, Height=2}
MinimizedWindowSpacingSize = {Width=160, Height=28}
SmallIconSize = {Width=16, Height=16}
ToolWindowCaptionHeight = 23
ToolWindowCaptionButtonSize = {Width=22, Height=22}
MenuButtonSize = {Width=19, Height=19}
ArrangeStartingPosition = Hide
ArrangeDirection = Left
MinimizedWindowSize = {Width=160, Height=28}
MaxWindowTrackSize = {Width=1940, Height=1100}
PrimaryMonitorMaximizedWindowSize = {Width=1936, Height=1096}
Network = True
TerminalServerSession = False
BootMode = Normal
DragSize = {Width=4, Height=4}
ShowSounds = False
MenuCheckSize = {Width=15, Height=15}
MidEastEnabled = False
NativeMouseWheelSupport = True
MouseWheelPresent = True
VirtualScreen = {X=0,Y=0,Width=1920,Height=1080}
MonitorCount = 1
MonitorsSameDisplayFormat = True
ComputerName = WZ1G89XBX
UserDomainName = LYZ
UserInteractive = True
UserName = pirklj
IsDropShadowEnabled = True
IsFlatMenuEnabled = True
IsFontSmoothingEnabled = True
FontSmoothingContrast = 1200
FontSmoothingType = 2
IconHorizontalSpacing = 75
IconVerticalSpacing = 75
IsIconTitleWrappingEnabled = True
MenuAccessKeysUnderlined = False
KeyboardDelay = 1
IsKeyboardPreferred = False
KeyboardSpeed = 31
MouseHoverSize = {Width=4, Height=4}
MouseHoverTime = 400
MouseSpeed = 10
IsSnapToDefaultEnabled = False
PopupMenuAlignment = Right
IsMenuFadeEnabled = True
MenuShowDelay = 400
IsComboBoxAnimationEnabled = True
IsTitleBarGradientEnabled = True
IsHotTrackingEnabled = True
IsListBoxSmoothScrollingEnabled = True
IsMenuAnimationEnabled = True
IsSelectionFadeEnabled = True
IsToolTipAnimationEnabled = True
UIEffectsEnabled = True
IsActiveWindowTrackingEnabled = False
ActiveWindowTrackingDelay = 0
IsMinimizeRestoreAnimationEnabled = False
BorderMultiplierFactor = 1
CaretBlinkTime = 530
CaretWidth = 1
MouseWheelScrollDelta = 120
VerticalFocusThickness = 1
HorizontalFocusThickness = 1
VerticalResizeBorderThickness = 4
HorizontalResizeBorderThickness = 4
ScreenOrientation = Angle0
SizingBorderWidth = 1
SmallCaptionButtonSize = {Width=22, Height=22}
MenuBarButtonSize = {Width=19, Height=19}
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-68311118566568915732022-06-09T09:41:00.001+02:002022-06-09T09:41:30.156+02:00c# - How to format interpolated stringsThis example writes double value with two decimal places.
<pre class="code">
double zoom = this.ZoomFactor * 100.0;
LStatusZoom.Text = $"Zoom: {zoom:0.##} %";
</pre>
Output:
<pre class="output">
Zoom: 80.25 %
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-52289351961741212912022-06-06T10:46:00.002+02:002022-12-08T09:30:58.907+01:00win os - How to copy all files defined by mask in all subdirectories into one directoryCopy all <b>*.mobi</b> files in current directory and all subdirectories into <b>c:\temp\mobi</b> directory. <div>The destination directory must exists.
<pre class="code">find . -name \*.mobi -exec cp {} c:/temp/mobi/ \;
</pre></div>
UPDATE: Better variant:
<pre class="code">
for /r %i in (*.epub) do xcopy /Y "%i" c:\temp\mobi
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-32008629912069132552022-05-10T19:07:00.001+02:002022-05-16T19:20:09.055+02:00c# - How to make DOWN button (in group of buttons)The goal: Only one button from group can be down.
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCpYyxYJjzDnWsxTHvLIz4d0BeU3n6ue9kKyNvXG3J0zqtQA-FH5KCxPUNHfNLjL45Oe7YVKEuXFJPdyxozWzYNUWXfFXrccV0EqHXOe4a9Y-sqQTOAy0dOh0izuMeMTArPO2tJryiW05kJVW2g5g4xYVYZE3qR8BRmLEjeYAmf0u3owGMt7tlbVsG/s335/down1.png" style="display: block; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="140" data-original-width="335" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCpYyxYJjzDnWsxTHvLIz4d0BeU3n6ue9kKyNvXG3J0zqtQA-FH5KCxPUNHfNLjL45Oe7YVKEuXFJPdyxozWzYNUWXfFXrccV0EqHXOe4a9Y-sqQTOAy0dOh0izuMeMTArPO2tJryiW05kJVW2g5g4xYVYZE3qR8BRmLEjeYAmf0u3owGMt7tlbVsG/s320/down1.png" width="320" /></a></div>
Every button link through <b>Click</b> event to this method:
<pre class="code">private void downclick( object sender, EventArgs e ) {
Button b = (Button)sender;
<span style="color: #38761d;">/* if is down -> do nothing */</span>
if ( b.BackColor == Color.IndianRed ) return;
<span style="color: #38761d;">/* set as down */</span>
b.BackColor = Color.IndianRed;
<span style="color: #38761d;">/* deselect others */</span>
b.Parent.Controls
.Cast<Control>()
.Where( x => x is Button )
.Cast<Button>()
.Where( x => x != b )
.ToList()
.ForEach( x => x.BackColor = Color.WhiteSmoke );
}
</pre>
So - pushed button = <i>Color.IndianRed</i>.
If you want to know which button is down pushed:
<pre class="code"> <span style="color: #38761d;">/* get down button */</span>
Button b = groupBox1.Controls
.Cast<Control>()
.Where( x => x is Button )
.Cast<Button>()
.Where( x => x.BackColor == Color.IndianRed )
.ToList()
.FirstOrDefault();
MessageBox.Show( b.Text );
}
</pre>
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikyGhJpA1cqXuc1yY6560zDEgB1rwEiklGoVOwjaq9y1q3gf_CtGZIKniwyy0mxLPeU7AjPF9_SgjuHhuuHp1T4YSyWvEFNPdZZQ0D6kdDI1_KLtYnZNovfQdnIQMRocCvGc_zq0mQ4awAshtADjOnfrgwRSP9ZG4OTurfzsPs-WVoYun7nCoSLqJV/s337/down2.png" style="display: block; padding: 1em 0px; text-align: center;"><img alt="" border="0" data-original-height="231" data-original-width="337" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikyGhJpA1cqXuc1yY6560zDEgB1rwEiklGoVOwjaq9y1q3gf_CtGZIKniwyy0mxLPeU7AjPF9_SgjuHhuuHp1T4YSyWvEFNPdZZQ0D6kdDI1_KLtYnZNovfQdnIQMRocCvGc_zq0mQ4awAshtADjOnfrgwRSP9ZG4OTurfzsPs-WVoYun7nCoSLqJV/s320/down2.png" width="320" /></a></div>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-8549352886144579792022-04-19T08:45:00.001+02:002022-04-19T08:45:51.982+02:00c# - How to create instance with string class nameString variable <i>sClass</i> contains for example <b>Box.LayoutItem</b> string. <i>ParentObject</i> and <i>ParentID</i> are optional constructor parameters.
<pre class="code">var p = <span style="background-color: #f1c232;">Activator.CreateInstance</span>( Type.GetType( sClass ), parentObject, parentID );
LayoutItem p1 = (LayoutItem)p;
p1.Load( x );
</pre>
Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0tag:blogger.com,1999:blog-7757564226177293646.post-12115011823716831792022-03-29T07:49:00.002+02:002022-03-29T07:49:51.047+02:00c# - How to solve error "Sequence contains no elements" by Max() LINQThis error occurs when the list is empty - no items are suitable for conditions.
<pre class="code">int xCalc = _layoutManager.Items
.Where( x=> x.ParentObject == this.ParentObject )
.Where( x=> x.LayoutRelativePosition == LayoutRelativePositionEnum.RIGHT )
.Where( x=> x.IDOrder < this.IDOrder )
.Max( x=> <span style="background-color: #f1c232;">x.xCalc + x.heightCalc</span> );
</pre>
Above Max() version returns in that situation (no items) error "Sequence contains no elements".
For solution you can use this format of the Max() function:
<pre class="code">int xCalc = _layoutManager.Items
.Where( x=> x.ParentObject == this.ParentObject )
.Where( x=> x.LayoutRelativePosition == LayoutRelativePositionEnum.RIGHT )
.Where( x=> x.IDOrder < this.IDOrder )
.Select(x => <span style="background-color: #f1c232;">x.xCalc + x.heightCalc</span> )
.<span style="background-color: #f1c232;">DefaultIfEmpty()</span>
.Max();
</pre>Josef Pirklhttp://www.blogger.com/profile/01991993269808132020noreply@blogger.com0