Exemplo n.º 1
0
        private void BlockForm_Load(object sender, EventArgs e)
        {
            List <ViewAbleDistricts> viewDistricts = DistrictHandler.GetViewAbleDistricts();

            foreach (ViewAbleDistricts vdist in viewDistricts)
            {
                districtComboBox.Items.Add(vdist.DistrictName);
            }
        }
Exemplo n.º 2
0
        private void VoterForm_Load(object sender, EventArgs e)
        {
            List <ViewAbleDistricts> viewDist = DistrictHandler.GetViewAbleDistricts();

            foreach (ViewAbleDistricts vDist in viewDist)
            {
                selectDistrcitComboBox.Items.Add(vDist.DistrictName);
                districtComboBox.Items.Add(vDist.DistrictName);
            }
        }
Exemplo n.º 3
0
        private void SeatForm_Load(object sender, EventArgs e)
        {
            List <ViewAbleDistricts> viewDistrict = DistrictHandler.GetViewAbleDistricts();

            foreach (ViewAbleDistricts vdist in viewDistrict)
            {
                addSeatComboBox.Items.Add(vdist.DistrictName);
                selectDistrictComboBox.Items.Add(vdist.DistrictName);
            }
        }
Exemplo n.º 4
0
        private void CandidateForm_Load(object sender, EventArgs e)
        {
            List <ViewAbleTeams>     vTeams = TeamHandler.GetViewAbleTeams();
            List <ViewAbleDistricts> vDists = DistrictHandler.GetViewAbleDistricts();

            foreach (ViewAbleTeams vteam in vTeams)
            {
                teamComboBox.Items.Add(vteam.TeamName);
            }
            foreach (ViewAbleDistricts vdist in vDists)
            {
                selectDistrictComboBox.Items.Add(vdist.DistrictName);
                districtComboBox.Items.Add(vdist.DistrictName);
            }
        }
Exemplo n.º 5
0
 private void deleteDistrictButton_Click(object sender, EventArgs e)
 {
     if (districtGrid.DataSource != null)
     {
         int          rowIndex = districtGrid.CurrentRow.Index;
         string       dname    = districtGrid.Rows[rowIndex].Cells[0].Value.ToString();
         DialogResult dr       = MessageBox.Show(string.Format("Are you sure to delete '{0}' from the database?", dname), "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             DistrictHandler.DeleteDistrict(dname);
             MessageBox.Show("Deleted");
             districtGrid.DataSource = DistrictHandler.GetViewAbleDistricts();
         }
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Main loop, runs the WebSocket connection.
        /// </summary>
        protected void RunSocket()
        {
            //We don't really need to store the handlers;
            //just create them and let them call our EnqueueMessage method.
            //XXX automatically find these like WebServer does.
            Log($"Creating socket handlers (thread: {Thread.CurrentThread.Name})");
            BudgetHandler       budgetHandler       = new BudgetHandler(this);
            BuildingHandler     buildingHandler     = new BuildingHandler(this);
            CameraHandler       cameraHandler       = new CameraHandler(this);
            ChirperHandler      chirperHandler      = new ChirperHandler(this);
            CitizenHandler      citizenHandler      = new CitizenHandler(this);
            CityInfoHandler     cityInfoHandler     = new CityInfoHandler(this);
            DebugHandler        debugHandler        = new DebugHandler(this);
            DistrictHandler     districtHandler     = new DistrictHandler(this);
            FlagsHandler        flagsHandler        = new FlagsHandler(this);
            InstancesHandler    instancesHandler    = new InstancesHandler(this);
            LimitsHandler       limitsHandler       = new LimitsHandler(this);
            NotificationHandler notificationHandler = new NotificationHandler(this);
            ReflectionHandler   reflectionHandler   = new ReflectionHandler(this);
            TerrainHandler      terrainHandler      = new TerrainHandler(this);
            TransportHandler    transportHandler    = new TransportHandler(this);
            VehicleHandler      vehicleHandler      = new VehicleHandler(this);

            Log("Waiting for messages");
            try {
                while (true)
                {
                    if (stream.DataAvailable)
                    {
                        HandleNextMessage();
                    }
                    String msg = GetNextOutgoingMessage();
                    if (msg != null)
                    {
                        byte[] buf = Encoding.UTF8.GetBytes(msg);
                        SendFrame(buf);
                    }
                    Thread.Sleep(100);
                }
            }
            catch (ObjectDisposedException) {
                //we're done, stream is closed
                Log("Connection closed");
            }
            catch (OperationCanceledException) {
                Log("Connection closed");
            }
        }
Exemplo n.º 7
0
 private void addDistrictButton_Click(object sender, EventArgs e)
 {
     if (addDistrictTextBox.Text != "")
     {
         DialogResult dr = MessageBox.Show(string.Format("Are you sure to add '{0}' to the database?", addDistrictTextBox.Text), "Confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             if (DistrictHandler.AddDistrict(addDistrictTextBox.Text))
             {
                 MessageBox.Show("Successfully added district.");
             }
             else
             {
                 MessageBox.Show("District name already present.");
             }
             addDistrictTextBox.Text = "";
             districtGrid.DataSource = DistrictHandler.GetViewAbleDistricts();
         }
     }
     else
     {
         MessageBox.Show("Enter a district name.");
     }
 }
Exemplo n.º 8
0
 private void Awake()
 {
     Instance = this;
     ActionHandler.OnActionUsed += () => { Selectable = true; };
     GetDistricts();
 }
Exemplo n.º 9
0
 private void showDistrictsButton_Click(object sender, EventArgs e)
 {
     districtGrid.DataSource = DistrictHandler.GetViewAbleDistricts();
 }