Exemple #1
0
 protected void Application_Start(object sender, EventArgs e)
 {
     try
     {
         CacheBL.GetInstance().RefreshCahce();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
        static void Main()
        {
            //FarmaKode.Client_TemporaryKey parolası FarmaKode
            CacheBL.LoadCache();


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            Common.AddShortcutToStartup();


            var wi = WindowsIdentity.GetCurrent();
            var wp = new WindowsPrincipal(wi);

            bool runAsAdmin = wp.IsInRole(WindowsBuiltInRole.Administrator);

            if (!runAsAdmin)
            {
                // It is not possible to launch a ClickOnce app as administrator directly,
                // so instead we launch the app as administrator in a new process.
                var processInfo = new ProcessStartInfo(Assembly.GetExecutingAssembly().CodeBase);

                // The following properties run the new process as administrator
                processInfo.UseShellExecute = true;
                processInfo.Verb            = "runas";

                // Start the new process
                try
                {
                    Process.Start(processInfo);
                }
                catch (Exception)
                {
                    // The user did not allow the application to run as administrator
                    KryptonMessageBox.Show("Yönetici (Admin) rolünde olmadığınız için uygulamayı çalıştıramazsınız");
                }

                // Shut down the current process
                Application.Exit();
            }
            else
            {
                // We are running as administrator
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new FormButton());
            }

            //RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
            //rk.SetValue("FarmaKode.Client.exe", Application.ExecutablePath);
        }
Exemple #3
0
        public FormButton()
        {
            InitializeComponent();

            if (!CacheBL.CheckSettings())
            {
                KryptonMessageBox.Show("Lütfen öncelikle uygulama için gereki olan bilgileri giriniz", "Uyarı");
                new FormSettings().ShowDialog();
            }

            InitializeWatchDog();
            LocationForm();
            CatchManuelBarcode();
            CheckForIllegalCrossThreadCalls = false;
        }
        public FormSettings()
        {
            InitializeComponent();

            Settings.Default.SettingChanging += Default_SettingChanging;



            #region Uygulama Durumu
            if (!Settings.Default.AppIsEnabled)
            {
                btnIsAppEnabled.Text      = "AKTİF yap";
                lblAppStatus.Text         = "Uygulama PASİF";
                pictureBoxAppStatus.Image = Resources.delete;
            }
            else
            {
                btnIsAppEnabled.Text      = "PASİF yap";
                lblAppStatus.Text         = "Uygulama AKTİF";
                pictureBoxAppStatus.Image = Resources.accept;
            }
            #endregion

            #region Kaynak ve Hedef Klasör Ayarları
            if (string.IsNullOrEmpty(Settings.Default.SourceFolder))
            {
                Settings.Default.SourceFolder = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
                Settings.Default.Save();
            }

            if (string.IsNullOrEmpty(Settings.Default.DestinationFolder))
            {
                Settings.Default.DestinationFolder = Path.Combine(@"C:\Program Files\Farmakode", Settings.Default.LatestPostFolderName);
                CacheBL.CheckSettings();
                Settings.Default.Save();
            }
            #endregion

            #region Yazıcı ayarları
            System.Drawing.Printing.PrinterSettings.StringCollection printerList = System.Drawing.Printing.PrinterSettings.InstalledPrinters;
            List <string> _printerList = new List <string>();

            foreach (string printer in printerList)
            {
                _printerList.Add(printer);
                comboDefaultBarcodePrinter.Items.Add(printer);
            }

            if (!_printerList.Contains(Settings.Default.DefaultBarcodePrinter))
            {
                comboDefaultBarcodePrinter.SelectedItem = LocalPrintServer.GetDefaultPrintQueue().FullName;
            }
            #endregion


            comboPCNO.Items.Clear();
            foreach (var item in Common.GetPcNumberList())
            {
                comboPCNO.Items.Add(item);
            }

            if (!string.IsNullOrEmpty(Settings.Default.PharmacyPCNO))
            {
                comboPCNO.SelectedItem = Settings.Default.PharmacyPCNO;
            }

            this.Text = "Ayarlar | " + CacheBL.IPAddress;

            comboNotificationPosition.SelectedIndex = Settings.Default.NotificationPosition;
        }