void OnTriggerEnter2D(Collider2D o)
 {
     if (o.tag == "Player")
     {
         NotificationObject.ChangeText(text);
     }
 }
Ejemplo n.º 2
0
        public void CallOperationUpdateArgument()
        {
            var o1 = new NotificationObject<string>()
            {
                Value1 = "Test",
                Value2 = "Te",
            };

            var op = new CallOperation<bool>(new OperationContext(),
                Expression.Call(
                    Expression.MakeMemberAccess(
                        Expression.Constant(o1),
                        typeof(NotificationObject<string>).GetProperty("Value1")),
                    typeof(string).GetMethod("StartsWith", new Type[] { typeof(string) }),
                    Expression.MakeMemberAccess(
                        Expression.Constant(o1),
                        typeof(NotificationObject<string>).GetProperty("Value2"))));
            Assert.IsTrue(op.Value);

            o1.Value2 = "st";
            Assert.IsFalse(op.Value);

            o1.Value2 = "Te";
            Assert.IsTrue(op.Value);
        }
Ejemplo n.º 3
0
 public void SendNotification(NotificationObject notificationObject)
 {
     foreach (var blockingQueue in notificationQueues.Values)
     {
         blockingQueue.Put(notificationObject);
     }
 }
Ejemplo n.º 4
0
        private void ExecuteShowCupView()
        {
            var cupId = AppSettingsHelper.GetValue("CupId", 1);

            _cupView.SetCupIdAndStartRefreshData(cupId);
            SelectedView = _cupView;
        }
Ejemplo n.º 5
0
    public void Start()
    {
        notifierObjMap = new Dictionary <NotificationType, List <NotificationObject> > ();
        NotificationObject[] notifierObjects = (NotificationObject[])FindObjectsOfType(typeof(NotificationObject));
        Debug.Log("Notifier objects found in scene: " + notifierObjects.Length);
        for (int i = 0; i < notifierObjects.Length; i++)
        {
            NotificationObject      n     = notifierObjects [i];
            List <NotificationType> types = n.getNotificationTypes();
            for (int j = 0; j < types.Count; j++)
            {
                NotificationType currType = types [j];
                if (!notifierObjMap.ContainsKey(currType))
                {
                    notifierObjMap [currType] = new List <NotificationObject> ();
                }

                notifierObjMap [currType].Add(n);
            }
        }

        if (NetworkInterface.GetIsNetworkAvailable())
        {
            thread = new Thread(new ThreadStart(ConnectPhone));
            thread.Start();
        }
        //ConnectPhone ();
    }
Ejemplo n.º 6
0
 void _Initialize()
 {
     _NowSQID  = new NotificationObject <SQID>(SQID.新規開始);
     _NextSQID = new NotificationObject <SQID>(SQID.新規開始);
     //WaitTaskTID.Clear();
     MessageList.Clear();
 }
 void OnTriggerExit2D(Collider2D o)
 {
     if (o.tag == "Player" && NotificationObject.currentText == text)
     {
         NotificationObject.ChangeText("");
     }
 }
Ejemplo n.º 8
0
 public void OnTriggerExit2D(Collider2D c)
 {
     if (c.tag == "Player")
     {
         entered = false;
         NotificationObject.Close();
     }
 }
Ejemplo n.º 9
0
 public void OnTriggerEnter2D(Collider2D c)
 {
     if (c.tag == "Player")
     {
         entered = true;
         NotificationObject.ChangeText(text);
     }
 }
        public SettingNavigationUserControl([Import(ComponentContract.Setting.ViewModelName, typeof(NotificationObject))] NotificationObject viewModel, [Import(typeof(ILogger))] ILogger logger)
        {
            Logger           = logger;
            Logger.LogSource = ComponentContract.Setting.LogSource;

            InitializeComponent();
            this.DataContext = viewModel;
        }
Ejemplo n.º 11
0
        public void DeleteNotiObjectById(int nObjectId)
        {
            NotificationObject nChange = notificationObjectRepository.FindById(nObjectId);

            if (nChange != null)
            {
                notificationObjectRepository.Delete(nChange);
            }
        }
Ejemplo n.º 12
0
    public void SpawnModel()
    {
        NotificationObject notificationObject = gameObject.GetComponent <NotificationObject> ();

        if (notificationObject != null)
        {
            notificationObject.SpawnObject(modelObj, true, false);
        }
    }
Ejemplo n.º 13
0
        /// <summary>
        /// Create element from existing element and view model
        /// </summary>
        /// <param name="element"></param>
        /// <param name="vm"></param>
        /// <returns></returns>
        public static FrameworkElement CreateElement(FrameworkElement element, NotificationObject vm)
        {
            if (null != element)
            {
                element.DataContext = vm;
            }

            return(element);
        }
Ejemplo n.º 14
0
        /// <summary>状态修改事件</summary>
        /// <param name="entityType">实体类型Id</param>
        /// <param name="type">状态类型</param>
        /// <param name="data">对应实体</param>
        void IEntityEventProxy.OnStatusChanged(int entityType, EntitySubsist type, NotificationObject data)
        {
            var msg = $@"
{StationProgram.Config.StationName}
{data.GetType().FullName}
{type}
{(data == null ? "{}" : JsonConvert.SerializeObject(data))}";

            Task.Factory.StartNew(Request, msg);
        }
Ejemplo n.º 15
0
 /// <summary>
 ///     构造
 /// </summary>
 /// <param name="data">数据</param>
 /// <param name="lockObj">锁定对象</param>
 private EditScope(NotificationObject data, object lockObj)
 {
     _data         = data;
     _preIsEditing = data.IsEditing;
     _lockObj      = lockObj ?? new object();
     if (!_preIsEditing)
     {
         _data.BeginEdit();
     }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Create element from resource xaml file and view model
        /// </summary>
        /// <param name="xamlFile"></param>
        /// <param name="vm"></param>
        /// <returns></returns>
        public static FrameworkElement CreateElementFromXmal(string xamlFile, NotificationObject vm)
        {
            FrameworkElement element;

            using (FileStream fs = new FileStream(xamlFile, FileMode.Open))
            {
                element = (FrameworkElement)XamlReader.Load(fs);
            }

            return(CreateElement(element, vm));
        }
Ejemplo n.º 17
0
 public long UpdateNotification(NotificationObject notification)
 {
     try
     {
         return(_notificationManager.UpdateNotification(notification));
     }
     catch (Exception ex)
     {
         ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message);
         return(0);
     }
 }
Ejemplo n.º 18
0
        private void Entity_PropertyChanged(TreeItem item, NotificationObject arg, string name)
        {
            var entity = (EntityConfig)arg;

            switch (name)
            {
            case null:
            case nameof(EntityConfig.NoDataBase):
                item.SoruceTypeIcon = Application.Current.Resources[entity.NoDataBase ? "tree_Type" : "tree_Child4"] as BitmapImage;
                break;
            }
        }
Ejemplo n.º 19
0
        public void Test_read()
        {
            var src = new NotificationObject<string>()
            {
                Value1 = "Test",
            };

            var op = new MemberAccessOperation<string>(new OperationContext(),
                Expression.MakeMemberAccess(
                    Expression.Constant(src),
                    typeof(NotificationObject<string>).GetProperty("Value1")));
            Assert.AreEqual("Test", op.Value);
        }
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         NotificationObject @object = NotificationLists[listView1.SelectedItems[0].Index];
         msgTitle.Text   = @object.Title;
         msgTime.Text    = @object.CreatedAt.ToString("yyyy-MM-dd HH:mm:ss");
         msgType.Text    = @object.Type.ToString();
         msgSendID.Text  = @object.Sender;
         msgRecvID.Text  = @object.GetStringRecivers();
         msgContent.Text = @object.Content;
     }
 }
Ejemplo n.º 21
0
    public void NewNotification(NotificationObject notificationObject = null)
    {
        foreach (var stat in playerStatus)
        {
            if (stat.Value < 1)
            {
                GameOver();
                PlayGame = false;
                Debug.Log("GameOver");
                return;
            }
        }

        if (daysCount > 7)
        {
            WinMatch();
            PlayGame = false;
            return;
        }

        if (PlayGame)
        {
            if (CheckStatusOfGame())
            {
                countToWinGame++;
            }

            if (countToWinGame <= 5)
            {
                DaysManager();
                if (!notificationObject)
                {
                    var notification = listNotifications.GetNotification(isDating, isWorking, isStudying);
                    Debug.Log(notification.titleNotification);
                    var go     = Instantiate(notification.notificationPrefab, notificationParent);
                    var prefab = go.GetComponent <NotificationPrefab>();
                    prefab.Init(notification, CallEnumerator, NewSpecificNotification);
                }
                else
                {
                    var go     = Instantiate(notificationObject.notificationPrefab, notificationParent);
                    var prefab = go.GetComponent <NotificationPrefab>();
                    prefab.Init(notificationObject, CallEnumerator, NewSpecificNotification);
                }
            }
            else
            {
                WinMatch();
            }
        }
    }
        /// <summary>
        /// Converts to string.
        /// </summary>
        /// <param name="value">NotificationObject object.</param>
        /// <returns>Coresponding string value.</returns>
        public static string GetString(NotificationObject value)
        {
            switch (value)
            {
                case NotificationObject.Data:
                    return DataString;

                case NotificationObject.DataRelation:
                    return DataRelationString;

                default:
                    return MeString;
            }
        }
Ejemplo n.º 23
0
        public static NotificationObject CloneSdkObject(NotificationObject ToClone)
        {
            var soap = new BinaryFormatter();
            var mem  = new MemoryStream();
            NotificationObject output = null;

            using (mem)
            {
                soap.Serialize(mem, ToClone);
                mem.Position = 0;
                output       = (NotificationObject)soap.Deserialize(mem);
            }
            return(output);
        }
Ejemplo n.º 24
0
    /// <summary>
    /// Adds a notification to the area
    /// </summary>
    /// <param name="text">The text of the n otification</param>
    /// <param name="textColor">thhe colour</param>
    /// <param name="timeToRemove">Time that the notificaion will live</param>
    /// <param name="speed">speed that the notification will fade away</param>
    public void DisplayNotification(string text, Color color, float timeUntilDestroy, NotificationObject.FadeSpeed speed = NotificationObject.FadeSpeed.Normal)
    {
        GameObject         newNotification = GameObject.Instantiate(m_NotificationObjectPrefab, m_notificationLayout.transform);
        NotificationObject script          = newNotification.GetComponent <NotificationObject>();

        if (script)
        {
            script.DisplayNotification(text, color, timeUntilDestroy, speed);
        }
        else
        {
            Destroy(newNotification);
        }
    }
Ejemplo n.º 25
0
        /// <summary>
        /// 通用
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public async Task SendToDevice(int deviceId, NotificationObject data)
        {
            try {
                var deviceNotification = new DeviceNotification {
                    DeviceId     = deviceId,
                    Notification = data
                };

                await SendToDevice(deviceNotification);
            }
            catch (Exception ex) {
                _logger.LogWarning($"SendToDevicen2错误:{deviceId},{ JsonHelper.ToJson( data )}, {ex}.");
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Converts to string.
        /// </summary>
        /// <param name="value">NotificationObject object.</param>
        /// <returns>Coresponding string value.</returns>
        public static string GetString(NotificationObject value)
        {
            switch (value)
            {
            case NotificationObject.Data:
                return(DataString);

            case NotificationObject.DataRelation:
                return(DataRelationString);

            default:
                return(MeString);
            }
        }
        private void Initialize(NotificationsAdapterViewHolder holder, NotificationObject notify)
        {
            try
            {
                switch (notify.Type)
                {
                case "memory":
                    Glide.With(ActivityContext).Load(Resource.Mipmap.icon).Apply(new RequestOptions().CircleCrop()).Into(holder.ImageUser);
                    holder.UserNameNotfy.Text = AppSettings.ApplicationName;
                    break;

                default:
                {
                    GlideImageLoader.LoadImage(ActivityContext, notify.Notifier?.Avatar, holder.ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                    var name = WoWonderTools.GetNameFinal(notify.Notifier);

                    string tempString = notify.Type == "share_post" || notify.Type == "shared_your_post"
                            ? name + " " + ActivityContext.GetText(Resource.String.Lbl_sharedYourPost)
                            : name + " " + notify.TypeText;
                    try
                    {
                        SpannableString spanString = new SpannableString(tempString);
                        spanString.SetSpan(new StyleSpan(TypefaceStyle.Bold), 0, name.Length, 0);

                        holder.UserNameNotfy.SetText(spanString, TextView.BufferType.Spannable);
                    }
                    catch
                    {
                        holder.UserNameNotfy.Text = tempString;
                    }

                    break;
                }
                }

                holder.TextNotfy.Text = Methods.Time.TimeAgo(Convert.ToInt32(notify.Time), false);

                AddIconFonts(holder, notify.Type, notify.Icon);

                var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor(GetColorFonts(notify.Type, notify.Icon)));
                holder.Image.SetImageDrawable(drawable);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        public static Exception Send(string token, NotificationObject notification)
        {
            var data = new
            {
                to   = token,
                data = new
                {
                    //title = notification.Title,
                    body = notification,
                }
            };

            var serializer = new JavaScriptSerializer();
            var json       = serializer.Serialize(data);

            Byte[] byteArray = Encoding.UTF8.GetBytes(json);

            try
            {
                WebRequest tRequest = WebRequest.Create("https://fcm.googleapis.com/fcm/send");
                tRequest.Method      = "post";
                tRequest.ContentType = "application/json";
                tRequest.Headers.Add($"Authorization: key={ServerAPIKey}");
                tRequest.Headers.Add($"Sender: id={SenderID}");

                tRequest.ContentLength = byteArray.Length;
                Stream stream = tRequest.GetRequestStream();
                stream.Write(byteArray, 0, byteArray.Length);
                stream.Close();

                WebResponse response = tRequest.GetResponse();
                stream = response.GetResponseStream();
                StreamReader reader = new StreamReader(stream);

                string responseFromServer = reader.ReadToEnd();

                reader.Close();
                stream.Close();
                response.Close();

                return(null);
            }

            catch (Exception ex)
            {
                return(ex);
            }
        }
Ejemplo n.º 29
0
        public void MemberInitOperationRead()
        {
            var src = new NotificationObject<string>()
            {
                Value1 = "Test",
            };

            var op = new MemberInitOperation<NotificationObject<string>>(new OperationContext(),
                Expression.MemberInit(
                    Expression.New(typeof(NotificationObject<string>)),
                    Expression.Bind(typeof(NotificationObject<string>).GetProperty("Value2"),
                        Expression.MakeMemberAccess(
                            Expression.Constant(src),
                            typeof(NotificationObject<string>).GetProperty("Value1")))));
            Assert.AreEqual("Test", op.Value.Value2);
        }
Ejemplo n.º 30
0
    private IEnumerator WaitNewNotification(NotificationObject notificationObject = null)
    {
        yield return(new WaitForSeconds(timeToNextNotification));

        smartphoneAnim.SetTrigger("Notification");
        yield return(new WaitForSeconds(1.0f));

        if (!notificationObject)
        {
            NewNotification();
        }
        else
        {
            NewNotification(notificationObject);
        }
    }
Ejemplo n.º 31
0
    private void InvokeEvent(NotificationObject not)
    {
        switch (not.Type)
        {
        case NotificationType.DuelRequest:
            OnDuelNotification(not.UserId, not.UserNickname);
            break;

        case NotificationType.FriendRequest:
            OnFriendNotification(not.UserId, not.UserNickname);
            break;

        case NotificationType.TradeRequest:
            OnTradeNotification(not.UserId, not.UserNickname);
            break;
        }
    }
Ejemplo n.º 32
0
        public override JObject Payload( )
        {
            Dictionary <string, object> aps = new Dictionary <string, object>( );

            Dictionary <string, object> apsDetails = new Dictionary <string, object>( );

            apsDetails.Add("content-available", 1);

            aps.Add("aps", apsDetails);
            aps.Add("acmkind", NotificationObject.GetType().Name);
            aps.Add("acmcloudid", NotificationObject.CloudIdentifier());
            aps.Add("acmtype", NotificationType);



            //return JObject.Parse(JsonConvert.SerializeObject(aps));

            return(JObject.FromObject(aps));
        }
Ejemplo n.º 33
0
        private string SendEmailNotification(string tokenforCall, string comment, string subject)
        {
            var client  = new RestClient("https://api-dev.sanlam.co.za/gti/communication-gateway/v1/message");
            var request = new RestRequest(Method.POST);

            request.AddHeader("cache-control", "no-cache");
            request.AddHeader("authorization", "Bearer " + tokenforCall);

            NotificationObject notificationObject = new NotificationObject();
            List <MessageItem> messageItems       = new List <MessageItem>();
            List <string>      recipients         = new List <string>();

            MessageItem    messageItem    = new MessageItem();
            MessagePayload messagePayload = new MessagePayload();

            messageItem.channel = "email";
            recipients.Add("*****@*****.**");
            recipients.Add("*****@*****.**");
            messageItem.destination     = recipients;
            messageItem.clientMessageId = "0000";

            messagePayload.payload_type = "text";
            messagePayload.subject      = subject;
            messagePayload.content      = comment;

            messageItem.message = messagePayload;
            messageItems.Add(messageItem);

            notificationObject.messages = messageItems;

            request.AddParameter("application/json; charset=utf-8", JsonConvert.SerializeObject(notificationObject), ParameterType.RequestBody);

            IRestResponse response = client.Execute(request);

            if (response.Content.ToLower().Contains("validation error"))
            {
                return("valadationfail");
            }
            else
            {
                return("notification sent.");
            }
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Convert a Avalondock ContentId into a viewmodel instance
        /// that represents a document or tool window. The re-load of
        /// this component is cancelled if the Id cannot be resolved.
        ///
        /// The result is (viewmodel Id or Cancel) is returned in <paramref name="args"/>.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void UpdateLayout(object sender, LayoutSerializationCallbackEventArgs args)
        {
            var resolver = this.DataContext as Edi.Interfaces.IViewModelResolver;

            if (resolver == null)
            {
                return;
            }

            // Get a matching viewmodel for that view via DataContext property of this view
            NotificationObject content_view_model = resolver.ContentViewModelFromID(args.Model.ContentId);

            if (content_view_model == null)
            {
                args.Cancel = true;
            }

            // found a match - return it
            args.Content = content_view_model;
        }
Ejemplo n.º 35
0
 public static NotificationObject CloneSdkObject(NotificationObject ToClone)
 {
     var soap = new BinaryFormatter();
     var mem = new MemoryStream();
     NotificationObject output = null;
     using (mem)
     {
         soap.Serialize(mem, ToClone);
         mem.Position = 0;
         output = (NotificationObject)soap.Deserialize(mem); 
     }
     return output;
 }
Ejemplo n.º 36
0
        public void SaveXML(string file)
        {
            var objects = new NotificationObject[]
                              {
                                  CollectionAreaTexture,
                                  CollectionColorArea
                              };

            var serializer = new SoapFormatter();

            var ms = new MemoryStream();
            using (ms)
            {
                serializer.Serialize(ms, objects);
                using (var stream = new FileStream(file, FileMode.Create))
                {
                    ms.WriteTo(stream);
                }
            }
        }