Example #1
0
        public frmKotaUpdate(Form caller, string State, Guid RowID)
        {
            InitializeComponent();
            this.Caller = caller;
            formMode    = enumFormMode.Update;
            _rowID      = RowID;

            switch (State)
            {
            case "Provinsi":
                formState = enumFormState.Prov;
                break;

            case "Kota":
                formState = enumFormState.Kota;
                break;

            case "Kecamatan":
                formState = enumFormState.Kec;
                break;

            case "Kelurahan":
                formState = enumFormState.Kel;
                break;
            }
        }
Example #2
0
        public frmKotaUpdate(Form caller, string State, string Nama, Guid rowID)
        {
            InitializeComponent();
            this.Caller = caller;
            formMode    = enumFormMode.New;

            switch (State)
            {
            case "Provinsi":
                formState = enumFormState.Prov;
                break;

            case "Kota":
                formState  = enumFormState.Kota;
                _provRowID = rowID;
                _namaProv  = Nama;
                break;

            case "Kecamatan":
                formState  = enumFormState.Kec;
                _kotaRowID = rowID;
                _namaKota  = Nama;
                break;

            case "Kelurahan":
                formState = enumFormState.Kel;
                _kecRowID = rowID;
                _namaKec  = Nama;
                break;
            }
        }
Example #3
0
        public frmWilayahUpdate(Form caller, string State, string Nama, Guid rowID, string Mode)
        {
            InitializeComponent();
            this.Caller = caller;
            if (Mode.Equals("New"))
            {
                formMode = enumFormMode.New;
            }
            else
            {
                formMode = enumFormMode.Update;
            }
            if (Mode.Equals("New"))
            {
                _rowID = Guid.NewGuid();
            }
            else
            {
                _rowID = rowID;
            }

            switch (State)
            {
            case "Area":
                formState = enumFormState.Area;
                break;

            case "Wilayah":
                formState = enumFormState.Wilayah;
                if (Mode.Equals("New"))
                {
                    _areaRowID = rowID;
                }
                _area = Nama;
                break;

            case "Kolektor":
                formState = enumFormState.Kolektor;
                if (Mode.Equals("New"))
                {
                    _areaRowID = rowID;
                }
                _area = Nama;
                break;
            }
        }
Example #4
0
        private void doUpdateFormState(enumFormState poState)
        {
            List<Control> toControlList = new List<Control>(){
                toolStrip_Footer
            };

            // Suspend drawing until layout changes are complete
            toControlList.ForEach(c => c.SuspendLayout());

            // Reset the controls
            toolStripButton_StartServer.Enabled = true;
            toolStripButton_StartServer.Text = "Start Server";

            // Refresh the bunny icon
            toolStripButton_StatusIcon.Image = null;

            // Apply selected state
            switch (poState)
            {
                case enumFormState.started:
                    toolStripButton_StatusIcon.Image = TerrariaServerCS.Properties.Resources.Bunny_Animated;
                    toolStripButton_StartServer.Enabled = true;
                    toolStripButton_StartServer.Text = "Stop Server";
                    break;

                case enumFormState.starting:
                    toolStripButton_StatusIcon.Image = TerrariaServerCS.Properties.Resources.Bunny_Animated;
                    toolStripButton_StartServer.Enabled = false;
                    label_AutosaveTimeRemainingData.Text = "<server not running>";
                    break;

                case enumFormState.stopped:
                    toolStripButton_StatusIcon.Image = TerrariaServerCS.Properties.Resources.Bunny;
                    label_AutosaveTimeRemainingData.Text = "<server not running>";
                    break;

                case enumFormState.stopping:
                    toolStripButton_StatusIcon.Image = TerrariaServerCS.Properties.Resources.Bunny_Animated;
                    toolStripButton_StartServer.Enabled = false;
                    toolStripButton_StartServer.Text = "Stop Server";
                    label_AutosaveTimeRemainingData.Text = "<server not running>";
                    break;

                case enumFormState.error:
                    toolStripButton_StatusIcon.Image = TerrariaServerCS.Properties.Resources.Bunny_Corrupt;
                    break;

                default:
                    throw new NotImplementedException("No code for state change: " + poState);
            }

            // Set the new state
            moFormState = poState;

            // Update the status message
            doTSUpdateStatus(Enum.GetName(typeof(enumFormState), poState), 0);

            // Check if the autosave timer should be running
            checkBox_AutoSave_CheckedChanged(null, null);

            // Force the controls to redraw
            toControlList.ForEach(c => c.ResumeLayout(true));
        }
Example #5
0
 /// <summary>
 /// [Thread Safe] Updates the state of the form
 /// </summary>
 /// <param name="poState"></param>
 private void doTSUpdateFormState(enumFormState poState)
 {
     // Check to make sure the object is not null in the case that a command is processed after the form closed
     try
     {
         this.Invoke((MethodInvoker)delegate
         {
             doUpdateFormState(poState);
         });
     }
     catch (Exception)
     {
         if (!this.IsDisposed)
             doUpdateFormState(poState);
     }
 }