Ejemplo n.º 1
0
    /* ----------------------------------
     * INIT: Used for late initialization after constructor
     * ----------------------------------*/
    void Init()
    {
        EditorApplication.update += this.Update;

        place.DataStructure  = HelperExtention.GetOrCreateSObjectReturn <StructSearchData>(ref place.DataStructure, PATH_SAVE_SCRIPTABLE_OBJECT);
        place.namePlaceСache = "";
        place.DataStructure.dataChache.Clear();

        addressDropdown = new DropDown("Address");
        map             = new GUIMap();
        map.Repaint    += Repaint;
        map.Zoom        = 19;

        geometriesReorderableList = new ReorderableList(new ArrayList(), typeof(GMLGeometry), true, true, true, true);
        geometriesReorderableList.drawHeaderCallback  += DrawGMLGeometryHeader;
        geometriesReorderableList.drawElementCallback += DrawGMLGeometry;
        geometriesReorderableList.onAddCallback       += AddGMLGeometry;
        geometriesReorderableList.onRemoveCallback    += RemoveGMLGeometry;
        geometriesReorderableList.onReorderCallback   += ReorderGMLGeometries;

        // Creating the geometry list
        geometries = new List <GMLGeometry>();
        // Set geometries list reference
        geometriesReorderableList.list = geometries;
        map.Geometries = geometries;
    }
Ejemplo n.º 2
0
        public static async Task <TResult> CampaignGroupWithVoice(string apiUrl, DataDto data)
        {
            TResult result = null;

            using var httpClient = new HttpClient();
            using var request    = new HttpRequestMessage(
                      new HttpMethod("POST"),
                      $"{apiUrl}")
                  {
                      Content = new StringContent(HelperExtention.ToDynamicJson(data))
                  };

            request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse($"{Constant.GatewayMediaTypeJson}");

            var response = await httpClient.SendAsync(request);

            response.EnsureSuccessStatusCode();

            await response.Content.ReadAsStringAsync().ContinueWith(x =>
            {
                if (x.IsFaulted)
                {
                    if (x.Exception != null)
                    {
                        throw x.Exception;
                    }
                }

                result = JsonConvert.DeserializeObject <TResult>(x.Result);
            });

            return(result);
        }
Ejemplo n.º 3
0
        //private string str;
        void OnEnable()
        {
            place = target as SearchPlace;
            place.DataStructure  = HelperExtention.GetOrCreateSObjectReturn <StructSearchData>(ref place.DataStructure, PATH_SAVE_SCRIPTABLE_OBJECT);
            place.namePlaceСache = "";
            //   place.namePlace = "";

            /*if (place.namePlace!=String.Empty)
             * {
             *  place.SearchInMapzen();
             * }
             * else
             * {
             *  place.DataStructure.dataChache.Clear();
             * }*/
        }
Ejemplo n.º 4
0
        //=========================================
        //===========  Helper Methods  ============
        //=========================================
        private static async Task <EventMessage> CreateStream(IServiceScopeFactory scopeFactory, DataDto data)
        {
            using var scope = scopeFactory.CreateScope();
            var serviceProvider = scope.ServiceProvider;
            var provider        = (IDataProvider)serviceProvider.GetService(typeof(IDataProvider));
            var result          = await provider.CreateDataAsync(new EventMessage
            {
                Message       = HelperExtention.ToDynamicJson(data),
                ResultMessage = "",
                ResultStatus  = "",
                SentStatus    = 0
            });

            provider.Commit();

            return(result);
        }
Ejemplo n.º 5
0
        /* --------------------------------
         * Constructor
         * ------------------------------*/
        public PlaceSearcher(string label)
        {
            addressDropdown = new DropDown(label);

            // Get existing open window or if none, make a new one:
            place = UnityEngine.Object.FindObjectOfType <SearchPlace>();
            if (place == null)
            {
                SearchPlace search = new GameObject("Searcher").AddComponent <SearchPlace>();
                place = search;
            }

            place.DataStructure  = HelperExtention.GetOrCreateSObjectReturn <StructSearchData>(ref place.DataStructure, PATH_SAVE_SCRIPTABLE_OBJECT);
            place.namePlaceСache = "";
            place.DataStructure.dataChache.Clear();

            EditorApplication.update += this.Update;
        }
Ejemplo n.º 6
0
        public async Task <ResponseDto> NotifyAsync(string message, string title, string[] recipient, string sender,
                                                    string scheduleDate, bool isSchedule = false, Attachment attachments = null)
        {
            //init data object
            var data = new DataDto
            {
                Message      = message,
                Recipient    = recipient,
                Sender       = sender,
                ScheduleDate = scheduleDate,
                IsSchedule   = isSchedule,
                File         = attachments?.File,
                Campaign     = title
            };

            var scopeFactory = _services
                               .BuildServiceProvider()
                               .GetRequiredService <IServiceScopeFactory>();

            var stream = await CreateStream(scopeFactory, data);


            if (!HelperExtention.IsNullAttachment(attachments))
            {
                _campaign = await ApiCallHelper <ResponseDto> .CampaignWithVoice(
                    $"{Constant.MnotifyGatewayJsonEndpoint}/voice/quick?key={ApiKey}",
                    data
                    );
                await InsertOrUpdateRecord(scopeFactory, stream);

                return(_campaign);
            }

            if (!HelperExtention.IsNullGroupWithMessage(null, null))
            {
                _campaign = await ApiCallHelper <ResponseDto> .CampaignGroup(
                    $"{Constant.MnotifyGatewayJsonEndpoint}/sms/group?key={ApiKey}",
                    data
                    );

                await InsertOrUpdateRecord(scopeFactory, stream);

                return(_campaign);
            }

            if (!HelperExtention.IsNullAttachmentWithGroup(attachments, null))
            {
                _campaign = await ApiCallHelper <ResponseDto> .CampaignGroupWithVoice(
                    $"{Constant.MnotifyGatewayJsonEndpoint}/voice/group?key={ApiKey}",
                    data
                    );

                await InsertOrUpdateRecord(scopeFactory, stream);

                return(_campaign);
            }

            _campaign = await ApiCallHelper <ResponseDto> .Campaign(
                $"{Constant.MnotifyGatewayJsonEndpoint}/sms/quick?key={ApiKey}",
                data
                );

            await InsertOrUpdateRecord(scopeFactory, stream);

            return(_campaign);
        }