void ReleaseDesignerOutlets()
        {
            if (ButtonCancel != null)
            {
                ButtonCancel.Dispose();
                ButtonCancel = null;
            }

            if (ButtonUpdate != null)
            {
                ButtonUpdate.Dispose();
                ButtonUpdate = null;
            }

            if (MapViewAddress != null)
            {
                MapViewAddress.Dispose();
                MapViewAddress = null;
            }

            if (TextFieldEmail != null)
            {
                TextFieldEmail.Dispose();
                TextFieldEmail = null;
            }

            if (TextFieldName != null)
            {
                TextFieldName.Dispose();
                TextFieldName = null;
            }
        }
示例#2
0
 void GrabUpdate(CustomHand hand)
 {
     if ((rightHand || leftHand) && GetMyGrabPoserTransform(hand))
     {
         hand.SkeletonUpdate();
         GetComponentInChildren <MeshRenderer>().material.color = Color.grey;
         float tempDistance = Mathf.Clamp(StartButtonPosition - (StartButtonPosition - transform.InverseTransformPoint(hand.PivotPoser.position).z) * DistanceMultiply, StartButtonPosition, distanseToPress);
         if (tempDistance >= distanseToPress)
         {
             GetComponentInChildren <MeshRenderer>().material.color = Color.blue;
             if (!press)
             {
                 ButtonDown.Invoke();
             }
             press = true;
             ButtonUpdate.Invoke();
         }
         else
         {
             if (press)
             {
                 ButtonUp.Invoke();
             }
             press = false;
         }
         MoveObject.localPosition = new Vector3(0, 0, tempDistance);
         MoveObject.rotation      = Quaternion.LookRotation(GetMyGrabPoserTransform(hand).forward, hand.PivotPoser.up);
         hand.GrabUpdateCustom();
     }
 }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.CustomMessages.Page_Load.jpg"/>
        /// </remarks>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Session["UserRole"] as string))
            {
                Response.Redirect("../Web/LogOn.aspx", true);
                return;
            }
            else if (Session["UserRole"] as string != "admin")
            {
                Response.Redirect("~/Administration/UnAuthorisedAccess.aspx");
            }

            if (!IsPostBack)
            {
                BinddropdownValues();
                ProvideLanguages();
                ProvideMesaages();
            }
            LocalizeThisPage();
            ButtonUpdate.Focus();

            LinkButton manageMessages = (LinkButton)Master.FindControl("LinkButtonCustomMessages");

            if (manageMessages != null)
            {
                manageMessages.CssClass = "linkButtonSelect_Selected";
            }
        }
        /// <summary>
        /// Handles the Click event of the IBEdit control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageDepartments.IBEdit_Click.jpg"/>
        /// </remarks>
        protected void IBEdit_Click(object sender, ImageClickEventArgs e)
        {
            string editvalue = "EDIT";

            HiddenFieldAddEdit.Value = "2";
            ButtonUpdate.Focus();
            EditDepartments(editvalue);
        }
        /// <summary>
        /// Handles the Click event of the IBEdit control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageDepartments.IBEdit_Click.jpg"/>
        /// </remarks>
        protected void IBEdit_Click(object sender, ImageClickEventArgs e)
        {
            TablePapersize.Visible = true;
            string editvalue = "EDIT";

            HiddenFieldAddEdit.Value = "2";
            ButtonUpdate.Focus();
            EditPaperSize(editvalue);
        }
示例#6
0
        private async void StartListener()
        {
            try
            {
                while (_connected)
                {
                    try
                    {
                        var ret = await _streamReader.ReadLineAsync();

                        if (ret == null)
                        {
                            Debug.WriteLine("Connection closed gracefully");
                            return;
                        }
                        Debug.WriteLine($"Got some text: {ret}");
                        _gotText?.Invoke(ret);
                        if (ret.StartsWith("S:LOAD ") || ret.StartsWith("R:GETLOAD "))
                        { //LOAD 123 55.0
                            var(vid, percent) = ret.ParseLoad();
                            LoadUpdate?.Invoke(vid, percent);
                        }
                        else if (ret.StartsWith("S:TASK ") || ret.StartsWith("R:GETTASK "))
                        {
                            var(vid, state) = ret.ParseTask();
                            TaskUpdate?.Invoke(vid, state);
                        }
                        else if (ret.StartsWith("S:BTN "))
                        {
                            var(vid, mode) = ret.ParseButton();
                            ButtonUpdate?.Invoke(vid, mode);
                        }
                        else if (ret.StartsWith("S:LED ") || ret.StartsWith("R:GETLED "))
                        {
                            var led = ret.ParseLed();
                            LedUpdate?.Invoke(led.Vid, led.State);
                        }
                        else if (ret.StartsWith("R:GETTHERMTEMP "))
                        {
                            var t = ret.ParseThermTemp();
                            TemperatureSensorUpdate?.Invoke(t.Vid, t.Sensor, t.Temperature);
                        }
                    }
                    catch {
                        if (!_tcpClient.Connected)
                        {
                            Debug.WriteLine("disconnected");
                            _connected = false;
                        }
                    }
                }
            }
            finally
            {
                _gotText?.Invoke(null);
            }
        }
        /// <summary>
        /// Handles the Click event of the IBEdit control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/>Instance containing the event data.</param>
        /// <remarks>Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageDepartments.IBEdit_Click.jpg"/></remarks>
        protected void IBEdit_Click(object sender, ImageClickEventArgs e)
        {
            TableAddGroups.Visible = true;
            string editvalue = "EDIT";

            HiddenFieldAddEdit.Value = "2";
            ButtonUpdate.Focus();
            EditCostCenters(editvalue);
            GetCostCenters();
            tablecellMainTable.Visible    = false;
            tablerowMainTable.Visible     = false;
            tablerowMain.Visible          = false;
            TextBoxCostCenterName.Enabled = false;
        }
        /// <summary>
        /// Handles the Click event of the IBEdit control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        ///  Sequence Diagram:<br/>
        /// <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageLanguage.IBEdit_Click.jpg" />
        /// </remarks>
        protected void IBEdit_Click(object sender, ImageClickEventArgs e)
        {
            DropDownListLanguage.Enabled = false;
            ImageMenuSplitBar.Visible    = true;
            IBAdd.Visible              = false;
            IBEdit.Visible             = false;
            PanelAddDepartment.Visible = true;
            string languageId = Request.Form["__LANGID"];

            editingLanguageID = languageId;
            CheckBoxLanguageActive.Checked = true;
            ImageButtonBack.Visible        = true;
            ImageButtonSave.Visible        = true;
            TableCellresetSpilt.Visible    = true;
            TableCellReset.Visible         = true;

            //Disable lock and un-lock cells
            tdImageLock.Visible         = false;
            tdImageLockButton.Visible   = false;
            tdImageUnLock.Visible       = false;
            tdImageUnLockButton.Visible = false;
            HiddenFieldAddEdit.Value    = "2";
            ButtonUpdate.Focus();

            DataSet dsLanguage = ApplicationSettings.ProvideLanguageById(languageId);

            if (dsLanguage.Tables[0].Rows.Count > 0)
            {
                DropDownListLanguage.Items.Clear();
                DropDownListLanguage.Items.Add(new ListItem(dsLanguage.Tables[0].Rows[0]["APP_LANGUAGE"].ToString(), dsLanguage.Tables[0].Rows[0]["APP_CULTURE"].ToString()));
                DropDownListUIDirection.SelectedIndex = DropDownListUIDirection.Items.IndexOf(DropDownListUIDirection.Items.FindByValue((dsLanguage.Tables[0].Rows[0]["APP_CULTURE_DIR"].ToString()).Trim()));
                string isRecardActive = Convert.ToString(dsLanguage.Tables[0].Rows[0]["REC_ACTIVE"], CultureInfo.CurrentCulture);
                if (!string.IsNullOrEmpty(isRecardActive))
                {
                    CheckBoxLanguageActive.Checked = bool.Parse(Convert.ToString(dsLanguage.Tables[0].Rows[0]["REC_ACTIVE"], CultureInfo.CurrentCulture));
                }
                else
                {
                    CheckBoxLanguageActive.Checked = false;
                }
                ButtonSave.Visible   = false;
                ButtonUpdate.Visible = true;
            }
            else
            {
                Response.Redirect("ManageLanguages.aspx");
            }
            TableLanguage.Visible = false;
        }
        /// <summary>
        /// Handles the Click event of the IBEdit control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/>Instance containing the event data.</param>
        /// <remarks>Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageDepartments.IBEdit_Click.jpg"/></remarks>
        protected void IBEdit_Click(object sender, ImageClickEventArgs e)
        {
            TableAddADGroup.Visible = true;
            string editvalue = "EDIT";

            HiddenFieldAddEdit.Value = "2";
            ButtonUpdate.Focus();
            EditDomainDetails(editvalue);
            GetActiveDirectorySettings();
            ButtonSave.Visible         = false;
            ButtonUpdate.Visible       = true;
            tablecellMainTable.Visible = false;
            tablerowMainTable.Visible  = false;
            TableMenuBar.Visible       = false;
        }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
    /// <remarks>
    /// Sequence Diagram:<br/>
    ///     <img src="SequenceDiagrams/SD_AdministrationJobConfiguration.Page_Load.jpg"/>
    /// </remarks>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Session["UserRole"] as string))
        {
            Response.Redirect("../Web/LogOn.aspx", true);
            return;
        }
        else if (Session["UserRole"] as string != "admin")
        {
            Response.Redirect("~/Administration/UnAuthorisedAccess.aspx");
        }


        if (!Page.IsPostBack)
        {
            BinddropdownValues();
            BindJobConfigurationSettings();
            DisplayJob();
        }
        AUDITORSOURCE = Session["UserID"] as string;
        LocalizeThisPage();

        string queryID = Request.Params["jid"];

        if (!string.IsNullOrEmpty(queryID))
        {
            if (queryID == "prj")
            {
                Tablecellback.Visible  = true;
                Tablecellimage.Visible = true;
            }
            if (queryID == "jlg")
            {
                Tablecellback.Visible  = true;
                Tablecellimage.Visible = true;
            }
        }
        ButtonUpdate.Focus();

        LinkButton jobConfiguration = (LinkButton)Master.FindControl("LinkButtonJobConfiguration");

        if (jobConfiguration != null)
        {
            jobConfiguration.CssClass = "linkButtonSelect_Selected";
        }
    }
示例#11
0
    public InputStateEvents()
    {
        VerticalEvent    = new AxisUpdate();
        HorizontalEvent  = new AxisUpdate();
        LookXEvent       = new AxisUpdate();
        LookYEvent       = new AxisUpdate();
        ZoomInEvent      = new AxisUpdate();
        FocusEvent       = new AxisUpdate();
        CrouchEvent      = new ButtonUpdate();
        InteractionEvent = new UnityEvent();

        AltHorizontalEvent  = new AxisEventParams();
        AltVerticalEvent    = new AxisEventParams();
        AltLookXEvent       = new AxisEventParams();
        AltLookYEvent       = new AxisEventParams();
        AltZoomInEvent      = new AxisEventParams();
        AltFocusEvent       = new AxisEventParams();
        AltCrouchEvent      = new ButtonEventParams();
        AltInteractionEvent = new UnityEventParams();
    }
示例#12
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageADSettings.Page_Load.jpg"/>
        /// </remarks>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Session["UserRole"] as string))
            {
                Response.Redirect("../Web/LogOn.aspx", true);
                return;
            }
            else if (Session["UserRole"] as string != "admin")
            {
                Response.Redirect("~/Administration/UnAuthorisedAccess.aspx");
            }

            if (!Page.IsPostBack)
            {
                BinddropdownValues();
                BindActiveDirectorySettings();
            }
            AUDITORSOURCE = Session["UserID"] as string;
            LocalizeThisPage();
            string queryID = Request.Params["id"];

            if (!string.IsNullOrEmpty(queryID))
            {
                Tablecellback.Visible  = true;
                Tablecellimage.Visible = true;
                ButtonCancel.Visible   = true;
            }
            else
            {
                ButtonCancel.Visible = false;
            }
            ButtonUpdate.Focus();

            LinkButton manageADDMSettings = (LinkButton)Master.FindControl("LinkButtonADandDMSettings");

            if (manageADDMSettings != null)
            {
                manageADDMSettings.CssClass = "linkButtonSelect_Selected";
            }
        }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
    /// <remarks>
    ///  Sequence Diagram:<br/>
    /// <img src="SequenceDiagrams/SD_AdministrationManageSettings.Page_Load.jpg" />
    /// </remarks>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Session["UserRole"] as string))
        {
            Response.Redirect("../Web/LogOn.aspx", true);
            return;
        }
        else if (Session["UserRole"] as string != "admin")
        {
            Response.Redirect("~/Administration/UnAuthorisedAccess.aspx");
        }

        applicationSettingCategory = Convert.ToString(Request.QueryString["AppsetngCategoery"], CultureInfo.CurrentCulture);

        if (string.IsNullOrEmpty(applicationSettingCategory))
        {
            applicationSettingCategory = "GeneralSettings";
        }

        if (applicationSettingCategory == "GeneralSettings")
        {
        }
        else
        {
        }
        if (!IsPostBack)
        {
            GetSetting(applicationSettingCategory);
        }
        ButtonUpdate.Focus();

        LinkButton manageSettings = (LinkButton)Master.FindControl("LinkButtonGeneralSettings");

        if (manageSettings != null)
        {
            manageSettings.CssClass = "linkButtonSelect_Selected";
        }
    }
示例#14
0
 public ButtonEventParams()
 {
     buttonEvent  = new ButtonUpdate();
     eventCounter = 0;
 }
示例#15
0
 private void ButtonUpdate_GotFocus(object sender, RoutedEventArgs e)
 {
     ButtonUpdate.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
 }
示例#16
0
        static void Main(string[] args)
        {
            /** BLUETOOTH INIT **/
            // Replace this COM port by the appropriate one on your computer
            SerialPort arduino = new SerialPort("COM7");

            //Open Arduino connection
            while (!arduino.IsOpen)
            {
                Console.WriteLine("Attempting to connect to Arduino (COM 7)...");
                try
                {
                    arduino.Open();
                } catch (Exception)
                {
                    System.Threading.Thread.Sleep(1000);
                }
            }
            Console.WriteLine("Connected to Arduino!");

            /** CONTROLLER INIT **/
            // Initialize DirectInput
            var directInput = new DirectInput();

            // Find a Joystick Guid
            var joystickGuid = Guid.Empty;

            foreach (var deviceInstance in directInput.GetDevices(DeviceType.Gamepad,
                                                                  DeviceEnumerationFlags.AllDevices))
            {
                joystickGuid = deviceInstance.InstanceGuid;
            }

            // If Gamepad not found, look for a Joystick
            if (joystickGuid == Guid.Empty)
            {
                foreach (var deviceInstance in directInput.GetDevices(DeviceType.Joystick,
                                                                      DeviceEnumerationFlags.AllDevices))
                {
                    joystickGuid = deviceInstance.InstanceGuid;
                }
            }

            // If Joystick not found, throws an error
            if (joystickGuid == Guid.Empty)
            {
                Console.WriteLine("No joystick/Gamepad found.");
                Console.ReadKey();
                Environment.Exit(1);
            }

            // Instantiate the joystick
            var joystick = new Joystick(directInput, joystickGuid);

            Console.WriteLine("Found Joystick/Gamepad with GUID: {0}", joystickGuid);

            // Set BufferSize in order to use buffered data.
            joystick.Properties.BufferSize = 128;

            // Acquire the joystick
            joystick.Acquire();

            // Poll events from joystick
            JoystickControlUpdate joyL = new JoystickControlUpdate();
            JoystickControlUpdate joyR = new JoystickControlUpdate();

            int  direction  = 1; //direction switch
            bool lastYState = false;

            /** EVENT LOOP **/
            while (true)
            {
                try
                {
                    //Poll joystick
                    joystick.Poll();
                    var updates = joystick.GetBufferedData();
                    //JoystickState state = joystick.GetCurrentState();

                    foreach (JoystickUpdate update in updates)
                    {
                        ControllerUpdate result = parseUpdate(update, joyL, joyR, direction);
                        if (result.updateType == ControllerUpdateType.BUTTON)
                        {
                            ButtonUpdate btnUpdate = (ButtonUpdate)result;

                            Console.WriteLine(btnUpdate.ToString());

                            //We have nothing to do with buttons right now

                            if ((btnUpdate.btn == JoystickButtons.Y) && (btnUpdate.pressed == true) && (lastYState == false))
                            {
                                direction = -direction;
                            }
                            if (btnUpdate.btn == JoystickButtons.Y)
                            {
                                lastYState = btnUpdate.pressed;
                            }
                        }
                        else if (result.updateType == ControllerUpdateType.JOYSTICK)
                        {
                            //TODO put everything below in here
                            JoystickControlUpdate joyUpdate = (JoystickControlUpdate)result;

                            //Flush if previous bin is not equal to previous bin
                            bool flush = false;
                            if (joyUpdate.getJoystick() == JoystickType.LEFT)
                            {
                                flush = (joyL.getBinX() != joyUpdate.getBinX()) || (joyL.getBinY() != joyUpdate.getBinY());
                                joyL  = joyUpdate;
                            }
                            if (joyUpdate.getJoystick() == JoystickType.RIGHT)
                            {
                                flush = (joyR.getBinX() != joyUpdate.getBinX()) || (joyR.getBinY() != joyUpdate.getBinY());
                                joyR  = joyUpdate;
                            }

                            try
                            {
                                Console.WriteLine(joyUpdate.ToBinnedString(direction));
                                if (flush)
                                {
                                    arduino.WriteLine(joyUpdate.ToBinnedString(direction));
                                }
                            }
                            catch (Exception)
                            {
                                if (!arduino.IsOpen)
                                {
                                    do
                                    {
                                        Console.WriteLine("Reconnecting to Arduino (COM 7)...");
                                        try
                                        {
                                            arduino.Open();
                                        }
                                        catch (Exception)
                                        {
                                            System.Threading.Thread.Sleep(1000);
                                        }
                                    } while (!arduino.IsOpen);
                                    Console.WriteLine("Connected to Arduino!");
                                }
                                else
                                {
                                    Console.WriteLine("Unknown Bluetooth exception. Restart program.");
                                }
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("Error reading from joystick.");
                    bool okay = false;
                    while (!okay)
                    {
                        try
                        {
                            joystick.Unacquire();
                            joystick.Acquire();
                            okay = true;
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
        }
 private void DGVPartners_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     ButtonUpdate.PerformClick();
 }