コード例 #1
0
ファイル: UXRStatusUpdateBuilder.cs プロジェクト: uxifiit/UXC
        public NodeStatusUpdate BuildStatusUpdate()
        {
            bool isRecording = _sessions.CurrentRecording != null && _sessions.CurrentRecording.IsFinished;

            SessionRecordingUpdate recording = null;

            if (_sessions.CurrentRecording != null && _sessions.CurrentRecording.IsFinished == false)
            {
                var currentRecording = _sessions.CurrentRecording;

                int sessionId;

                recording = new SessionRecordingUpdate()
                {
                    SessionId   = _uxrSessions.TryGetUXRSessionId(currentRecording.Definition, out sessionId) ? sessionId : new int?(),
                    SessionName = currentRecording.Definition.Name,
                    StartedAt   = currentRecording.StartedAt,
                    Streams     = currentRecording.Definition
                                  .Devices
                                  .Select(d => d.Device.Code)             // TODO IsConnected, IsRecording
                                  .ToList()
                };
            }

            NodeStatusUpdate update = new NodeStatusUpdate()
            {
                Name      = _node.NodeName,
                Recording = recording,
            };

            return(update);
        }
コード例 #2
0
ファイル: NodeApiController.cs プロジェクト: uxifiit/UXR
        public IHttpActionResult Update([FromBody] NodeStatusUpdate status)
        {
            if (status != null)
            {
                string nodeName = status.Name;
                var    node     = _database.Nodes
                                  .FilterByName(nodeName)
                                  .SingleOrDefault();

                if (node != null)
                {
                    var command = new UpdateNodeStatusCommand()
                    {
                        Node        = node,
                        IsRecording = status.Recording != null,
                        Session     = status.Recording?.SessionName
                    };

                    _dispatcher.Dispatch(command);

                    return(Ok(Mapper.Map <NodeIdInfo>(node)));
                }

                return(NotFound());
            }

            return(BadRequest());
        }
コード例 #3
0
ファイル: FormMain.cs プロジェクト: bookorz/Lilith
 public void On_Status_Changed(string Type, string Message)
 {
     switch (Type.ToUpper())
     {
     case "EFEM":
         NodeStatusUpdate.UpdateCurrentState(Message);
         break;
     }
 }
コード例 #4
0
ファイル: AlarmUpdate.cs プロジェクト: bookorz/Sachiel
        public static void UpdateAlarmList(List <AlarmInfo> AlarmList)
        {
            try
            {
                Form         form = Application.OpenForms["FormAlarm"];
                DataGridView AlarmList_gv;



                if (form == null)
                {
                    return;
                }


                AlarmList_gv = form.Controls.Find("AlarmList_gv", true).FirstOrDefault() as DataGridView;
                if (AlarmList_gv == null)
                {
                    return;
                }

                if (AlarmList_gv.InvokeRequired)
                {
                    UpdateAlarm ph = new UpdateAlarm(UpdateAlarmList);

                    AlarmList_gv.BeginInvoke(ph, AlarmList);
                }
                else
                {
                    //JobList_gv.DataSource = null;
                    AlarmList_gv.DataSource = AlarmList.ToList();

                    //Conn_gv.Refresh();
                    AlarmList_gv.ClearSelection();
                    AlarmList_gv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                    NodeStatusUpdate.UpdateCurrentState(FormMain.RouteCtrl.EqpState);
                    if (AlarmList.Count() != 0)
                    {
                        form.Visible = true;
                    }
                    else
                    {
                        form.Visible = false;
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error("UpdateAlarmList: Update fail." + e.Message + "\n" + e.StackTrace);
            }
        }
コード例 #5
0
ファイル: FormMain.cs プロジェクト: bookorz/Lilith
        public void On_Node_State_Changed(Node Node, string Status)
        {
            logger.Debug("On_Node_State_Changed");
            NodeStatusUpdate.UpdateNodeState(Node.Name, Status);
            switch (Node.Name)
            {
            case "ROBOT01":
            case "ROBOT02":
                ManualRobotStatusUpdate.UpdateRobotStatus(Node.Name, Status);    //update 手動功能畫面
                break;

            case "ALIGNER01":
            case "ALIGNER02":
                ManualAlignerStatusUpdate.UpdateAlignerStatus(Node.Name, Status);    //update 手動功能畫面
                break;
            }
        }
コード例 #6
0
        public async Task <NodeIdInfo> UpdateNodeStatusAsync(NodeStatusUpdate status, CancellationToken cancellationToken)
        {
            status.ThrowIfNull(nameof(status));

            try
            {
                var response = await _client.PostAsync(ApiRoutes.Node.ResolveUpdateRoute(), status, mediaType, cancellationToken);

                if (response.IsSuccessStatusCode)
                {
                    return(await response.Content.ReadAsAsync <NodeIdInfo>());
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }

            return(null);
        }
コード例 #7
0
ファイル: FormSignalTower.cs プロジェクト: bookorz/Sachiel
        private void btnSave_Click(object sender, EventArgs e)
        {
            if ((DataTable)lsbCondition.DataSource == null || ((DataTable)lsbCondition.DataSource).Rows.Count == 0)
            {
                MessageBox.Show("The grid data does not exist.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                return;
            }

            if (lsbCondition.SelectedIndex < 0)
            {
                MessageBox.Show("Choose the condition.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                return;
            }

            //權限檢查
            using (var form = new FormConfirm("是否儲存變更?"))
            {
                var result = form.ShowDialog();
                if (result != DialogResult.OK)
                {
                    MessageBox.Show("Cancel.", "Notice");
                    return;
                }
            }

            string strSql = string.Empty;
            Dictionary <string, object> keyValues = new Dictionary <string, object>();

            try
            {
                strSql = "UPDATE config_signal_tower " +
                         "SET red = @red, " +
                         "orange = @orange, " +
                         "green = @green, " +
                         "blue = @blue, " +
                         "buzzer1 = @buzzer1, " +
                         "buzzer2 = @buzzer2, " +
                         "update_user = @update_user, " +
                         "update_time = NOW() " +
                         "WHERE eqp_status  =  @eqp_status " +
                         "AND is_alarm = @is_alarm ";

                Form  form   = Application.OpenForms["FormMain"];
                Label Signal = form.Controls.Find("lbl_login_id", true).FirstOrDefault() as Label;

                keyValues.Add("@red", cmbRad.Text.ToString());
                keyValues.Add("@orange", cmbYellow.Text.ToString());
                keyValues.Add("@green", cmbGreen.Text.ToString());
                keyValues.Add("@blue", cmbBlue.Text.ToString());
                keyValues.Add("@buzzer1", cmbBuzzer1.Text.ToString());
                keyValues.Add("@buzzer2", cmbBuzzer2.Text.ToString());
                keyValues.Add("@update_user", Signal.Text);
                keyValues.Add("@eqp_status", lsbCondition.Text.Split('-')[0].ToString());
                keyValues.Add("@is_alarm", Convert.ToUInt64(lsbCondition.SelectedValue.ToString()));

                dBUtil.ExecuteNonQuery(strSql, keyValues);

                MessageBox.Show("Done it.", "Save", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                Adam.Util.SanwaUtil.addActionLog("Adam.Menu.SystemSetting", "FormSignalTower", Signal.Text);

                UpdateList();

                txbEqpStatus.Text          = string.Empty;
                txbIsAlarm.Text            = string.Empty;
                cmbBlue.SelectedIndex      = -1;
                cmbGreen.SelectedIndex     = -1;
                cmbRad.SelectedIndex       = -1;
                cmbYellow.SelectedIndex    = -1;
                cmbBuzzer1.SelectedIndex   = -1;
                cmbBuzzer2.SelectedIndex   = -1;
                lsbCondition.SelectedIndex = -1;
                //改設定後套用
                NodeStatusUpdate.InitialSetting();
                NodeStatusUpdate.UpdateCurrentState(FormMain.RouteCtrl.EqpState);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }