Skip to content

Instantly share code, notes, and snippets.

View arman-hpp's full-sized avatar
😊
Focusing

Arman Hasanpour arman-hpp

😊
Focusing
View GitHub Profile
@arman-hpp
arman-hpp / serialbox.cs
Last active July 6, 2018 03:47
serialbox
private const int MaxLen = 7;
txtSerial1.MaxLength = MaxLen;
txtSerial2.MaxLength = MaxLen;
txtSerial3.MaxLength = MaxLen;
txtSerial4.MaxLength = MaxLen;
@arman-hpp
arman-hpp / radcombobox.cs
Created August 2, 2018 03:13
radcombobox.cs
private void cmbDocumnetType_VisualListItemFormatting(object sender, VisualItemFormattingEventArgs args)
{
args.VisualItem.Font = cmbDocumnetType.Font;
}
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)
@arman-hpp
arman-hpp / InvokeFast.cs
Created July 25, 2019 03:11
InvokeFast
public void FuncInvoke()
{
var del = (Func<int, bool, int>)Delegate.CreateDelegate(typeof(Func<int, bool, int>), Obj, Method);
var arg0 = (int)Args[0];
var arg1 = (bool)Args[1];
del(arg0, arg1);
}
@arman-hpp
arman-hpp / CultureTest.cs
Created August 27, 2019 04:58
CultureTest
private void button1_Click(object sender, EventArgs e)
{
// Declare a Resource Manager instance.
ResourceManager LocRM = new ResourceManager("CultureTest.Language", typeof(Form1).Assembly);
// Assign the string for the "strMessage" key to a message box.
MessageBox.Show(LocRM.GetString("Hello"));
}
private void button2_Click(object sender, EventArgs e)
{
1- download Node.js from https://nodejs.org/en/download/ and install it.
2- npm install -g npm@latest
3- npm i -g create-react-app
4- in VSCODE instal this ext:
- Simple React Snippets
- Prettier
- Eslint
public enum TestEnum
{
A,
B,
C
}
var t = ~TestEnum.A; // t = ~1;
var t = ~TestEnum.B; // t = ~1;
var t = ~TestEnum.C; // t = ~1;
@arman-hpp
arman-hpp / Enum.IsDefined.cs
Created May 21, 2020 03:16
Enum.IsDefined
public KeyboardLayoutType LayoutType
{
get
{
return this.layoutType;
}
set
{
if (!Enum.IsDefined(typeof (KeyboardLayoutType), (object) value))
throw new ArgumentException("Invalid LayoutType. When setting the LayoutType property, it must be a valid member of the KeyboardLayoutType enumeration!");
@arman-hpp
arman-hpp / SignController.cs
Created July 19, 2020 15:36
SignController.cs
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Web.Http;
namespace SignGenApi.Controllers
{
public class SignController : ApiController
{
@arman-hpp
arman-hpp / JsonIgnore.cs
Created December 2, 2020 10:06
JsonIgnore
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace ConsoleApp1