Biskilog POS desktop appilcation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
4.8 KiB

using BiskLog_Point_Of_Sale.Company_Setup;
using BiskLog_Point_Of_Sale.Multiple_Login;
using BiskLog_Point_Of_Sale.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BiskLog_Point_Of_Sale
{
public partial class Splashscreen : Form
{
public static string macAddress, ppd;
public Splashscreen()
{
InitializeComponent();
macAddress = GetMACAddress2();
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
}
private void Timer1_Tick(object sender, EventArgs e)
{
loader.Width = loader.Width + 10;
if (pictureBox1.Location.X <= 699)
{
pictureBox1.Location = new Point(pictureBox1.Location.X + 15,10);
}
else
{
pictureBox1.Visible = false;
if (main.Width <= 330 && main.Height <= 320)
{
main.Visible = true;
main.Width = main.Width + 10;
main.Height = main.Height + 10;
}
else
{
if (label2.Location.Y > 300)
label2.Location = new Point(label2.Location.X, label2.Location.Y - 20);
}
}
if ((loader.Width) >= 716)
{
timer1.Stop();
this.Hide();
CreateProfile();
}
}
public string GetMACAddress2()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
String sMacAddress = string.Empty;
foreach (NetworkInterface adapter in nics)
{
if (sMacAddress == String.Empty)
{
//IPInterfaceProperties properties = adapter.GetIPProperties();
sMacAddress = adapter.GetPhysicalAddress().ToString();
}
}
return sMacAddress;
}
public void CreateProfile()
{
if (Settings.Default.Configured)
{
MainLogin main = new MainLogin();
main.BringToFront();
main.ShowDialog();
this.Dispose();
}
else
{
FirstPage main = new FirstPage();
main.BringToFront();
main.ShowDialog();
this.Dispose();
}
}
private void Splashscreen_Load(object sender, EventArgs e)
{
// OnInit();
timer1.Start();
}
#region Trial Section :
// This function does all the work
[DllImport("License.dll", EntryPoint = "ReadSettingsStr", CharSet = CharSet.Ansi)]
static extern uint InitTrial(String aKeyCode, IntPtr aHWnd);
// Use this function to register the application when the application is running
[DllImport("License.dll", EntryPoint = "DisplayRegistrationStr", CharSet = CharSet.Ansi)]
static extern uint DisplayRegistration(String aKeyCode, IntPtr aHWnd);
// The kLibraryKey is meant to prevent unauthorized use of the library.
// Do not share this key. Replace this key with your own from Advanced Installer
// project > Licensing > Registration > Library Key
private const string kLibraryKey = "7567B7C67C88D9C0D266BB6CD3AB8FD1EF8317";
private static void OnInit()
{
try
{
Process process = Process.GetCurrentProcess();
InitTrial(kLibraryKey, process.MainWindowHandle);
}
catch (DllNotFoundException ex)
{
// Trial dll is missing close the application immediately.
MessageBox.Show(ex.ToString());
Process.GetCurrentProcess().Kill();
}
catch (Exception ex1)
{
MessageBox.Show(ex1.ToString());
}
}
private void RegisterApp(object sender, EventArgs e)
{
try
{
Process process = Process.GetCurrentProcess();
DisplayRegistration(kLibraryKey, process.MainWindowHandle);
}
catch (DllNotFoundException ex)
{
// Trial dll is missing close the application immediately.
MessageBox.Show(ex.ToString());
}
catch (Exception ex1)
{
MessageBox.Show(ex1.ToString());
}
}
#endregion
}
}