Form1.cs 4.95 KB
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WebCam;
using ImageFilters;
using NpgsqlAltPool;
using DynamicPg;
using Npgsql;
using System.IO;
using MoyaAdminLib;

namespace RamaSignup
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            RestClient.ApiApplicationKey = Properties.Settings.Default.ApiApplicationKey;
            RestClient.ApiPass = Properties.Settings.Default.ApiPass;
            RestClient.ApiUser = Properties.Settings.Default.ApiUser;
            RestClient.ApiURL = Properties.Settings.Default.ApiURL;
            InitializeComponent();
        }


        enum Language
        {
            Finnish = 0,
            English = 1,
        }
//        Language currentLanguage = Language.English;

        /*
        void changed()
        {
            if (!pictureTaken )
            {

                    this.lblMessage.Text = "Ota kuva ensin painamalla 'Käytä tätä kuvaa' nappia";
                
                this.lblMessage.ForeColor = Color.Red;
                this.btnSave.Enabled = false;
                return;
            }
           
            this.lblMessage.ForeColor = Color.Green;

                this.lblMessage.Text = "OK, varmista tietojen oikeellisuus ja tallenna";
            
            this.btnSave.Enabled = true;
        }*/

       


        

        private void Form1_Load(object sender, EventArgs e)
        {
            if (AutoUpdateLib.AutoUpdateCore.CheckForUpdates(null))
            {
                Application.ExitThread();		//program is required to close by autoupdate (probably updated)
                return;
            }
            

            
            

        }

 

        bool pictureTaken;

        private void btnFinnish_Click(object sender, EventArgs e)
        {

        }

        private void btnEnglish_Click(object sender, EventArgs e)
        {

        }


        
        bool checkSaveSafety()
        {
            return true;
        }
         
        /*
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!checkSaveSafety())
            {
                this.btnSave.Enabled = false;
                return;
            }

            this.Cursor = Cursors.WaitCursor;
            this.btnSave.Enabled = false;
            this.Enabled = false;
            this.btnSave.Refresh();

            
            //savePicture(pid);


            MessageBox.Show("Tallennus onnistui.\r\nMene infotiskille, ja kerro heille tämä numero, niin he opastavat sinut eteenpäin.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            
            
            this.Enabled = true;
            this.Cursor = Cursors.Default;
        }*/


        bool allowShutdown;
        /*
        private void txtName_TextChanged(object sender, EventArgs e)
        {
            changed();
        }*/

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!allowShutdown)
            {
                e.Cancel = true;
            }
            else
            {
            }
        }

        private void Form1_Deactivate(object sender, EventArgs e)
        {
            if (!allowShutdown)
                this.Activate();
        }

        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Alt && e.Control && e.KeyCode == Keys.S)
            {
                allowShutdown = true;
                Application.Exit();
                return;
            }
        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Alt && e.Control && e.KeyCode == Keys.S)
            {
                allowShutdown = true;
                this.Close();
                return;
            }
        }


        

        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
         /*   if (e.Button == MouseButtons.Right)
            {
                allowShutdown = true;
                Application.Exit();
                return;
            }*/
        }
        
        

        private void button1_Click(object sender, EventArgs e)
        {
            allowShutdown = true;
            Application.Exit();
        }

        private void userLoginControl1_LoginOk(object sender, EventArgs e)
        {
            userLoginControl1.Visible = false;
            userDetailsEditor1.LoadUser(userLoginControl1.CurrentUser);
            userLoginControl1.Clear();
            userDetailsEditor1.Visible = true;
            //userLoginControl1.CurrentUser;
        }

        private void userDetailsEditor1_Load(object sender, EventArgs e)
        {

        }

        private void userDetailsEditor1_CloseView(object sender, EventArgs e)
        {
            userDetailsEditor1.Visible = false;
            userLoginControl1.Visible = true;
        }

        
    }
}