Esempio n. 1
0
        private String performValidityCheckAndUpdateHMI()
        {
            // Check if valid
            String err = "";

            if (favmgrtextBox1.Text == "")
            {
                err += _daddy.GetTranslator().GetString("ErrEmptyName") + "\r\n";
            }


            Double dlon = Double.MaxValue;
            Double dlat = Double.MaxValue;

            if (ParameterObject.SplitLongitudeLatitude(favmgrtextBox2.Text, ref dlon, ref dlat))
            {
                // Ok tout va bien
            }
            else
            {
                String format = _daddy.GetTranslator().GetString("ErrWrongParameter");
                err += String.Format(format.Replace("#", "\r\n"), label2.Text, typeof(double).ToString(), favmgrtextBox2.Text, "") + "\r\n";
            }

            if (err == "")
            {
                // It's valid,
                _coord._Name = favmgrtextBox1.Text;
                _coord._Lat  = dlat.ToString().Replace(",", ".");
                _coord._Lon  = dlon.ToString().Replace(",", ".");
            }

            return(err);
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            String latlon = favmgrtextBox2.Text;
            Double dlon   = Double.MaxValue;
            Double dlat   = Double.MaxValue;

            if (ParameterObject.SplitLongitudeLatitude(latlon, ref dlon, ref dlat))
            {
                _daddy.HandlerToDisplayCoordinates(dlat, dlon);
            }
        }
Esempio n. 3
0
        private void favmgrbtnEdit_Click(object sender, EventArgs e)
        {
            Double dlon, dlat;

            _daddy.GetInitialCoordinates(out dlat, out dlon);

            if (ParameterObject.SplitLongitudeLatitude(favmgrtextBox2.Text, ref dlon, ref dlat))
            {
                // Ok tout va bien
            }
            else
            {
                dlon = _daddy.HomeLon;
                dlat = _daddy.HomeLat;
            }

            List <ParameterObject> lst = new List <ParameterObject>();

            lst.Add(new ParameterObject(ParameterObject.ParameterType.String, favmgrtextBox1.Text, "nme", label1.Text));
            lst.Add(new ParameterObject(ParameterObject.ParameterType.Coordinates /*good*/,
                                        dlat.ToString() + " " + dlon.ToString(),
                                        "latlon",
                                        label2.Text,
                                        _daddy.GetTranslator().GetString("TooltipParamLatLon").Replace("#", "\r\n")));
            ParametersChanger changer = new ParametersChanger();

            changer.HandlerDisplayCoord = _daddy.HandlerToDisplayCoordinates;
            changer.DisplayCoordImage   = _daddy.GetImageSized("Earth");
            changer.Title         = _daddy.GetTranslator().GetString("DlgFavManager");
            changer.BtnCancel     = _daddy.GetTranslator().GetString("BtnCancel");
            changer.BtnOK         = _daddy.GetTranslator().GetString("BtnOk");
            changer.ErrorFormater = _daddy.GetTranslator().GetString("ErrWrongParameter");
            changer.ErrorTitle    = _daddy.GetTranslator().GetString("Error");
            changer.Parameters    = lst;
            changer.Font          = this.Font;
            changer.Icon          = this.Icon;

            if (changer.ShowDialog() == DialogResult.OK)
            {
                dlon = Double.MaxValue;
                dlat = Double.MaxValue;
                if (ParameterObject.SplitLongitudeLatitude(lst[1].Value, ref dlon, ref dlat))
                {
                    this.favmgrtextBox1.Text = lst[0].Value;
                    this.favmgrtextBox2.Text = dlat.ToString().Replace(",", ".") + " " + dlon.ToString().Replace(",", ".");
                    performValidityCheckAndUpdateHMI();
                }
            }
        }
Esempio n. 4
0
        void BtnGCNGUpdateClick(object sender, EventArgs e)
        {
            String fct = "updatepublishnotifications";

            try
            {
                if (!SpecialFeatures.SpecialFeaturesMgt.AreSpecialFeaturesEnabled())
                {
                    return;
                }
                CookieContainer cookieJar = _daddy.CheckGCAccount(true, false);
                if (cookieJar == null)
                {
                    return;
                }

                List <GCNotification> associatedGCN;
                List <String>         ids = GetSelectedIds(out associatedGCN);
                if (ids.Count == 0)
                {
                    _daddy.MsgActionWarning(this, _daddy.GetTranslator().GetString("LblErrorNoSelectionElt"));
                    return;
                }

                List <ParameterObject> lst = new List <ParameterObject>();
                lst.Add(new ParameterObject(ParameterObject.ParameterType.Coordinates /*good*/, _daddy.GetInitialCoordinates(), "latlon", _daddy.GetTranslator().GetString("ParamCenterLatLon"), _daddy.GetTranslator().GetStringM("TooltipParamLatLon")));

                ParametersChanger changer = new ParametersChanger();
                changer.HandlerDisplayCoord = _daddy.HandlerToDisplayCoordinates;
                changer.DisplayCoordImage   = _daddy.GetImageSized("Earth");
                changer.Title         = _daddy.GetTranslator().GetString("updatepublishnotifications");
                changer.BtnCancel     = _daddy.GetTranslator().GetString("BtnCancel");
                changer.BtnOK         = _daddy.GetTranslator().GetString("BtnOk");
                changer.ErrorFormater = _daddy.GetTranslator().GetString("ErrWrongParameter");
                changer.ErrorTitle    = _daddy.GetTranslator().GetString("Error");
                changer.Parameters    = lst;
                changer.Font          = _daddy.Font;
                changer.Icon          = _daddy.Icon;

                // Force creation du get handler on control
                changer.CreateControls();
                _daddy._cacheDetail._gmap.ControlTextLatLon = changer.CtrlCallbackCoordinates;

                if (changer.ShowDialog() == DialogResult.OK)
                {
                    _daddy._cacheDetail._gmap.ControlTextLatLon = null;
                    Double dlon = Double.MaxValue;
                    Double dlat = Double.MaxValue;
                    if (ParameterObject.SplitLongitudeLatitude(lst[0].Value, ref dlon, ref dlat))
                    {
                        foreach (String id in ids)
                        {
                            NotificationsManager.UpdateNotificationsImpl(_daddy, id, cookieJar, dlat, dlon);
                        }

                        _daddy.MsgActionDone(this);
                    }
                }
                else
                {
                    _daddy._cacheDetail._gmap.ControlTextLatLon = null;
                }
            }
            catch (Exception ex)
            {
                _daddy.ShowException("", _daddy.GetTranslator().GetString(fct), ex);
            }
        }