This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string GetImei() | |
{ | |
var permissionCheck = ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadPhoneState); | |
if (permissionCheck == Permission.Denied) | |
{ | |
ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.ReadPhoneState }, 0); | |
} | |
var mTelephonyMgr = (TelephonyManager)GetSystemService(TelephonyService); | |
if (Build.VERSION.SdkInt >= BuildVersionCodes.O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void cmbDocumnetType_VisualListItemFormatting(object sender, VisualItemFormattingEventArgs args) | |
{ | |
args.VisualItem.Font = cmbDocumnetType.Font; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private const int MaxLen = 7; | |
txtSerial1.MaxLength = MaxLen; | |
txtSerial2.MaxLength = MaxLen; | |
txtSerial3.MaxLength = MaxLen; | |
txtSerial4.MaxLength = MaxLen; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH CTE AS | |
( | |
SELECT * | |
,ROW_NUMBER() OVER | |
( | |
PARTITION BY [CreditVerifierRoleId],[CreditRuleJobGroupId],[CreditGrade],[SalaryRate],[AveragingRate],[AveragingMonthDuration],[MaxCredit],[MaxGuaranteePerCustomer],[CreditRuleType],[BeginDate],[EndDate],[CreatedOn],[CreatedBy],[ModifiedOn],[ModifiedBy] | |
ORDER BY [CreditVerifierRoleId],[CreditRuleJobGroupId],[CreditGrade],[SalaryRate],[AveragingRate],[AveragingMonthDuration],[MaxCredit],[MaxGuaranteePerCustomer],[CreditRuleType],[BeginDate],[EndDate],[CreatedOn],[CreatedBy],[ModifiedOn],[ModifiedBy] | |
) AS RN | |
FROM [QTasBankDatabase].[Loan].[CreditRules] | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void GetInfo() | |
{ | |
var domain = new PrincipalContext(ContextType.Domain); | |
Console.WriteLine("Domain.Name: " + domain.Name); | |
Console.WriteLine("Domain.UserName: " + domain.UserName); | |
Console.WriteLine("Domain.ConnectedServer: " + domain.ConnectedServer); | |
Console.WriteLine("Domain.ContextType: " + domain.ContextType); | |
Console.WriteLine("Domain.Options: " + domain.Options); | |
Console.WriteLine("Domain.Container: " + domain.Container); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void button1_Click() | |
{ | |
var scope = new ManagementScope("root\\CIMV2") {Options = {EnablePrivileges = true}}; | |
try | |
{ | |
var query = new WqlEventQuery | |
{ | |
EventClassName = "__InstanceCreationEvent", | |
WithinInterval = new TimeSpan(0, 0, 1), | |
Condition = @"TargetInstance ISA 'Win32_USBControllerdevice'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ManagementEventWatcher watcher = new ManagementEventWatcher(); | |
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_DeviceChangeEvent"); | |
watcher.EventArrived += Watcher_EventArrived; | |
watcher.Query = query; | |
watcher.Start(); | |
watcher.WaitForNextEvent(); | |
private static void Watcher_EventArrived(object sender, EventArrivedEventArgs e) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SynchronizationContext ctx = SynchronizationContext.Current; | |
int count = 0; | |
Parallel.ForEach(collection, (item) => | |
{ | |
ComputeYourStuff(item); | |
Interlocked.Increment(ref count); | |
ctx.Post(d => { progressBar.Value = count; }, null); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class JEncyptor | |
{ | |
public static Tuple<string, string> CreateKeyPair() | |
{ | |
var cspParams = new CspParameters { ProviderType = 1 }; | |
var rsaProvider = new RSACryptoServiceProvider(1024, cspParams); | |
var publicKey = Convert.ToBase64String(rsaProvider.ExportCspBlob(false)); | |
var privateKey = Convert.ToBase64String(rsaProvider.ExportCspBlob(true)); | |
return new Tuple<string, string>(privateKey, publicKey); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT STUFF(STUFF(13961201, 5, 0, '/'), 8, 0, '/') |