Exemplo n.º 1
0
    /// <summary>
    /// 清除输入框值
    /// </summary>
    /// <param name="dev"></param>
    private void ClearArchorValue(DevNode dev)
    {
        CommunicationObject service = CommunicationObject.Instance;
        Archor archor = service.GetArchorByDevId(dev.Info.Id);

        if (archor != null && !string.IsNullOrEmpty(archor.Code))
        {
            try
            {
                DevTypeDropdown.value = (int)archor.Type;
            }catch (Exception e)
            {
                DevTypeDropdown.value = 0;
            }
            DevCode.text   = archor.Code.ToString();
            XPosInput.text = archor.X.ToString();
            YPosInput.text = archor.Y.ToString();
            ZPosInput.text = archor.Z.ToString();
        }
        else
        {
            DevTypeDropdown.value = 0;
            DevCode.text          = "";
            XPosInput.text        = "";
            YPosInput.text        = "";
            ZPosInput.text        = "";
        }
        DevName.text        = dev.Info.Name;
        valueText.text      = "";
        SaveInfoResult.text = "";
    }
Exemplo n.º 2
0
    /// <summary>
    /// 保存设备信息
    /// </summary>
    private void SaveInfo()
    {
        if (!ArchorToolManage.Instance.SignSetPart.IsArchorSet)
        {
            SaveInfoResult.text = "基准点未设置。";
            return;
        }
        if (currentDev == null)
        {
            SaveInfoResult.text = "当前选中设备为空,位置计算失败。";
            return;
        }
        if (currentArchor == null)
        {
            SaveInfoResult.text = "测量值未输入";
            return;
        }
        //Todo:保存基站信息,修改DevInfo信息
        CommunicationObject service = CommunicationObject.Instance;

        if (service)
        {
            Archor archor     = service.GetArchorByDevId(currentDev.Info.Id);
            string archorName = DevName.text;
            if (!string.IsNullOrEmpty(archorName))
            {
                archor.Name = archorName;
            }
            else
            {
                archor.Name = currentDev.Info.Name;
            }
            if (DevTypeDropdown.value == 0)
            {
                archor.Type = ArchorTypes.副基站;
            }
            else
            {
                archor.Type = ArchorTypes.主基站;
            }
            archor.Code = DevCode.text;
            archor.X    = currentArchor.X;
            archor.Y    = currentArchor.Y;
            archor.Z    = currentArchor.Z;
            bool value = service.EditArchor(archor, (int)currentDev.Info.ParentId);
            Debug.Log("Edit Archor value:" + value);
            ShowSaveResult(value);
        }
    }