예제 #1
0
    /// <summary>
    /// 获取城市信息
    /// </summary>
    /// <param name="_strCityName"></param>
    /// <param name="callback"></param>
    public static void GetCityInfo(string _strCityName, Action <string> callback)
    {
        if (_strCityName.Contains(" "))
        {
            Debug.LogWarning("城市名称[" + _strCityName + "]包含空格,请留意!");
            _strCityName = _strCityName.Trim();
        }

        WWWManager.Instance.Get("cities/fetch_city", new NameValueCollection()
        {
            { "city_name", _strCityName }
        }, resp =>
        {
            if (resp.Error != HttpResp.ErrorType.None)
            {
                InfoTips.LogInfo("Get Material Error: " + resp.ToString());
                callback(resp.ToString());
            }
            else
            {
                //Debug.LogWarning("加载出来的CmpConfig:" + resp.WwwText);
                //MonoHelper.Instance.SaveInfo(resp.WwwText);
                callback(resp.WwwText);
            }
        });
    }
예제 #2
0
 /// <summary>
 /// 获取临时数据接口:name,type 不指定,获取的是所有临时数据
 /// </summary>
 /// <param name="_strName"></param>
 /// <param name="_strType"></param>
 /// <param name="callback"></param>
 public static void GetTempData(string _strName, string _strType, Action <string> callback, Action <string> _failCb = null)
 {
     WWWManager.Instance.Get("temp_buildings/fetch_info", new NameValueCollection()
     {
         { "name", _strName },
         { "type", _strType }
     }, resp =>
     {
         if (resp.Error != HttpResp.ErrorType.None)
         {
             InfoTips.LogInfo("temp_buildings/fetch_info" + resp.ToString());
             if (_failCb != null)
             {
                 _failCb(resp.WwwText);
             }
             else
             {
                 callback(resp.ToString());
             }
         }
         else
         {
             callback(resp.WwwText);
         }
     });
 }
예제 #3
0
 public void MoveInfoTipProperty(PropertyListEntry toMove, PropertyListEntry target, bool before)
 {
     if (toMove != target)
     {
         InfoTips.Remove(toMove);
         InsertPropertyInProperties(InfoTips, toMove, target, before);
     }
 }
예제 #4
0
파일: frmMain.cs 프로젝트: coshkun/CapCalc
        private void cmbConSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            numLong.Maximum   = (decimal)((ContainerInfo)cmbConSelector.SelectedValue).Long;
            numHeight.Maximum = (decimal)((ContainerInfo)cmbConSelector.SelectedValue).Height;
            numWidth.Maximum  = (decimal)((ContainerInfo)cmbConSelector.SelectedValue).Width;
            numWeight.Maximum = (decimal)((ContainerInfo)cmbConSelector.SelectedValue).Weight;

            summary = "Long: " + (((ContainerInfo)cmbConSelector.SelectedValue).Long / 100).ToString() + "m \n"
                      + "Height: " + (((ContainerInfo)cmbConSelector.SelectedValue).Height / 100).ToString() + "m \n"
                      + "Width: " + (((ContainerInfo)cmbConSelector.SelectedValue).Width / 100).ToString() + "m \n"
                      + "Capacity: " + (((ContainerInfo)cmbConSelector.SelectedValue).CBM / 1000000).ToString() + "m3 \n"
                      + "Payload: " + (((ContainerInfo)cmbConSelector.SelectedValue).Weight / 1000).ToString() + " tons";
            //if(this.isLoaded)
            InfoTips.SetToolTip(cmbConSelector, summary);
        }
예제 #5
0
 public static void GetCmpConfig(string _strCmpName, Action <string> callback)
 {
     WWWManager.Instance.Get("components/fetch_info", new NameValueCollection()
     {
         { "name", _strCmpName }
     }, resp =>
     {
         if (resp.Error != HttpResp.ErrorType.None)
         {
             InfoTips.LogInfo("Get Material Error: " + resp.ToString());
             callback(resp.ToString());
         }
         else
         {
             //Debug.LogWarning("加载出来的CmpConfig:" + resp.WwwText);
             //MonoHelper.Instance.SaveInfo(resp.WwwText,"原始组件配置");
             callback(resp.WwwText);
         }
     });
 }
예제 #6
0
    public static bool HasRespError(HttpResp resp, bool autoShowError = true)
    {
        var hasError = resp.Error != HttpResp.ErrorType.None;

        if (hasError)
        {
            lastErrorMsg = resp.ToString();

            if (resp.Error == HttpResp.ErrorType.AccessExpired)
            {
            }
            else if (autoShowError)
            {
                //Dialog.ShowLastHttpError();
                //new WindowAlertDialog(resp.Error.ToString()).Show();
            }
            InfoTips.LogInfo("网络错误" + resp.Error.ToString() + ": " + resp.WwwText);
        }

        return(hasError);
    }
예제 #7
0
 public void RemoveInfoTipProperty(PropertyListEntry property)
 {
     InfoTips.Remove(property);
 }
예제 #8
0
파일: frmMain.cs 프로젝트: coshkun/CapCalc
        private void frmMain_Load(object sender, EventArgs e)
        {
            // Calculate Shema and Displays
            x      = new Point(lbl_X.Location.X, lbl_X.Location.Y);
            y      = new Point(lbl_Y.Location.X, lbl_Y.Location.Y);
            z      = new Point(lbl_Z.Location.X, lbl_Z.Location.Y);
            L      = new Point(lbl_L.Location.X, lbl_L.Location.Y);
            picBox = new Point(pBox.Location.X, pBox.Location.Y);
            offset = new Point(grpSelectedCargo.Width / 2,
                               grpSelectedCargo.Height / 2);
            dX   = offset.X - x.X; dY = offset.X - y.X; dZ = offset.X - z.X; dL = offset.X - L.X;
            eX   = offset.Y - x.Y; eY = offset.Y - y.Y; eZ = offset.Y - z.Y; eL = offset.Y - L.Y;
            dPic = offset.X - picBox.X; ePic = offset.Y - picBox.Y;

            // initialize the shematic in accordance of platform
            string rslt = GetOSFriendlyName();

            if (rslt.Contains("Windows 10"))
            {
                pBox.Image = Properties.Resources.cargo_picker_w10;
            }

            // initialize the Color Picker
            cd            = new ColorDialog();
            cd.FullOpen   = true;
            pC            = Helper.GetRandomColor(); cd.Color = pC;
            txtColor.Text = ColorTranslator.ToHtml(pC);

            // initialize the data table
            dt = new DataTable();
            dt.Columns.AddRange(new DataColumn[] {
                new DataColumn("ID", typeof(string)),
                new DataColumn("Name", typeof(string)),
                new DataColumn("Long", typeof(double)),
                new DataColumn("Height", typeof(double)),
                new DataColumn("Width", typeof(double)),
                new DataColumn("Level", typeof(int)),
                new DataColumn("Weight", typeof(double)),
                new DataColumn("CBM", typeof(double)),
                new DataColumn("Color", typeof(string))
            });
            ds = new DataSet();
            ds.Tables.Add(dt);

            // Refresh Grid
            dataGridView1.DataSource            = ds.Tables[0];
            dataGridView1.Columns["ID"].Visible = false;

            // Initialize Inteli Naming Array,
            for (int i = 0; i < 1000; i++)
            {
                NameArray[i] = "Cargo " + string.Format("{0:000}", i);
            }

            // Initialize Konteyner to hold the Max Capacity.
            Konteyners.Add(new ContainerInfo("13.6 Semitrailer", 1360, 280, 240, 22000));
            cmbConSelector.DataSource    = Konteyners.ToArray();
            cmbConSelector.DisplayMember = "Name";
            // var usage = ((ContainerInfo)cmbConSelector.SelectedValue).CBM;

            // Create ToolTip Handler
            InfoTips.ToolTipIcon  = ToolTipIcon.Info;
            InfoTips.ToolTipTitle = "Info:";
            InfoTips.SetToolTip(cmbConSelector, summary);

            // Fill the Offset Selector
            cmbOffset.Items.Add(@"Top Left"); cmbOffset.Items.Add(@"Top Center"); cmbOffset.Items.Add(@"Top Right");
            cmbOffset.Items.Add(@"Middle Left"); cmbOffset.Items.Add(@"Middle Center"); cmbOffset.Items.Add(@"Middle Right");
            cmbOffset.Items.Add(@"Bottom Left"); cmbOffset.Items.Add(@"Bottom Center"); cmbOffset.Items.Add(@"Bottom Right");
            // initialize an instance of Selector Helper
            frmOffsetHelper        = new frmImageTip(cmbOffset);
            frmOffsetHelper.Image  = new Bitmap(Properties.Resources.go_none);
            cmbOffset.SelectedItem = @"Middle Left";

            // Note this flag must be the last event line! it is a Legacy System Fix for Indexy Controls
            isLoaded = true;
        }