public void AddBehavior(string userName, UserBehavior behavior)
 {
     if (behaviors.ContainsKey(userName))
         behaviors[userName] = behavior;
     else
         behaviors.Add(userName, behavior);
 }
Beispiel #2
0
    public static void doItems()
    {
        /* find the user that brought up a menu, and call its menuItems method */
        string user_name = menus.MenuLevel(1);
        //Debug.Log("look in dict for " + component_name);
        UserBehavior script = user_dict[user_name];
        int          level  = ccUtils.SubstringCount(menus.clicked, ":");

        if (level == 1)
        {
            WindowRect = GUI.Window(1, WindowRect, script.MenuItems, "Item");
        }
        else
        {
            string submenu = menus.MenuLevel(2);
            Debug.Log("submenu is <" + submenu + "> level is " + level + " clicked " + menus.clicked);
            switch (submenu)
            {
            case "Configure":
                Debug.Log("is configure");
                script.Configure();
                break;
            }
        }
    }
Beispiel #3
0
    public static void UpdateStatus(string message)
    {
        StringReader xmlreader = new StringReader(message);
        //xmlreader.Read(); // skip BOM ???

        XmlDocument xml_doc = new XmlDocument();

        //Debug.Log("UserBehavior UpdateStatus xml is " + message);

        xml_doc.Load(xmlreader);
        XmlNodeList user_nodes = xml_doc.SelectNodes("//user_status/user");

        foreach (XmlNode user in user_nodes)
        {
            string user_name = user["name"].InnerText;
            //Debug.Log("the name is " + user_name);
            if (!user_dict.ContainsKey(user_name))
            {
                //Debug.Log("UserBehavior name not in dictionary " + user_name);
                continue;
            }
            UserBehavior user_script = user_dict[user_name];
            user_script.UpdateUserStatus(user);
        }
    }
Beispiel #4
0
    public static UserBehavior GetNextUser()
    {
        UserBehavior first_user = null;
        bool         gotit      = false;

        foreach (KeyValuePair <string, UserBehavior> entry in user_dict)
        {
            UserBehavior user = entry.Value;
            if (!user.IsActiveUser())
            {
                continue;
            }
            if (gotit)
            {
                current_user = user;
                return(user);
            }
            if (first_user == null)
            {
                first_user = user;
            }
            if (current_user == null)
            {
                current_user = user;
                return(user);
            }
            if (user == current_user)
            {
                gotit = true;
            }
        }
        current_user = first_user;
        return(first_user);
    }
Beispiel #5
0
        public IActionResult Post(UserBehavior userBehavior)
        {
            #region Opens the channel and connection to RabbitMQ server
            ConnectionRabbitMQ connectionRabbitMQ = new ConnectionRabbitMQ();
            connectionRabbitMQ.GetConnection();
            connectionRabbitMQ.routingKey = "UserBehaviorQueue";
            connectionRabbitMQ.OpenChannel();
            #endregion

            #region Sets the visitor IP
            userBehavior.ip = Request.HttpContext.Connection.RemoteIpAddress.ToString();
            #endregion

            #region Serializes the entity UserBehavior to JSon format
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            var jsonUserBehavior = javaScriptSerializer.Serialize(userBehavior);
            #endregion

            #region Publishes the message on RabbitMQ
            connectionRabbitMQ.PublishMessage(jsonUserBehavior);
            #endregion

            #region Closes the connection to RabbitMQ
            connectionRabbitMQ.CloseChannel();
            #endregion

            return(Ok("User Behavior has been sent."));
        }
Beispiel #6
0
    static void LoadItems()
    {
        NetworkBehavior.LoadNetworks(user_app_path);
        procedural_settings = new ProceduralScript("procedural.txt");
        physical_settings   = new ProceduralScript("physical.txt");
        Debug.Log("Calling LoadHardwareTypes");
        CatalogBehavior.LoadHardwareTypes();
        CatalogBehavior.LoadCatalog(user_app_path);
        OrganizationScript.LoadOrganization();
        GameObject      ws        = GameObject.Find("WorkSpace");
        WorkSpaceScript ws_script = (WorkSpaceScript)ws.GetComponent(typeof(WorkSpaceScript));

        WorkSpaceScript.LoadWorkSpace();
        dac_groups = new DACGroups();
        UserBehavior.LoadUsers();
        AssetBehavior.LoadAssets();
        ComputerBehavior.LoadAllComputers();
        DeviceBehavior.LoadDevices(user_app_path);
        ITStaffBehavior.LoadStaffFromFile();
        ZoneBehavior.LoadZones();
        ObjectivesBehavior.LoadObjectives();

        //UserBehavior.UpdateStatus();
        //LoadMainOffice();
    }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            // TODO Add user facebook id and token
            User user = new User("", "");

            _behavior = new UserBehavior(user, this);

            _isLiking = false;

            _likeCount       = FindViewById <TextView>(Resource.Id.like_count);
            _profileName     = FindViewById <TextView>(Resource.Id.contact_name);
            _profileImage    = FindViewById <ImageView>(Resource.Id.contact_image);
            _startStopButton = FindViewById <Button>(Resource.Id.start_stop_button);

            _startStopButton.Click += delegate
            {
                if (_isLiking)
                {
                    _startStopButton.Text = GetString(Resource.String.StartLikingButton);
                    _behavior.StopAutoLiking();
                }
                else
                {
                    _startStopButton.Text = GetString(Resource.String.StopLikingButton);
                    _behavior.StartAutoLiking();
                }
                _isLiking = !_isLiking;
            };
        }
Beispiel #8
0
 public void Add(UserBehavior request)
 {
     request.User    = request?.User ?? this.PKSUser.Identity.Name;
     request.Role    = request?.Role ?? this.PKSUser.Roles.First().Name;
     request.LogDate = request?.LogDate ?? DateTime.UtcNow;
     request.LogId   = request?.LogId ?? Guid.NewGuid().ToString();
     ServiceImpl.Add(request);
 }
Beispiel #9
0
 public void AddBehavior(string userName, UserBehavior behavior)
 {
     if (behaviors.ContainsKey(userName))
     {
         behaviors[userName] = behavior;
     }
     else
     {
         behaviors.Add(userName, behavior);
     }
 }
Beispiel #10
0
 public UserEvent(string userName, string IP, int? categoryID, int? productID, Guid orderID,
     UserBehavior behavior)
 {
     this.DateCreated = DateTime.Now;
     UserName = userName;
     this.IP = IP;
     this.CategoryID = categoryID;
     this.ProductID = productID;
     this.OrderID = orderID;
     this.Behavior = behavior;
 }
Beispiel #11
0
 public UserEvent(string userName, string IP, int?categoryID, string sku, Guid orderID,
                  UserBehavior behavior)
 {
     this.DateCreated = DateTime.Now;
     UserName         = userName;
     this.IP          = IP;
     this.CategoryID  = categoryID;
     this.SKU         = sku;
     this.OrderID     = orderID;
     this.Behavior    = behavior;
 }
        public void Train(UserBehavior db)
        {
            UserBehaviorTransformer ubt = new UserBehaviorTransformer(db);

            ratings = ubt.GetUserMenuRatingsTable(rater);

            List <MenuCategoryCounts> menuCategories = ubt.GetMenuCategoryCounts();

            ratings.AppendMenuFeatures(menuCategories);

            FillTransposedRatings();
        }
Beispiel #13
0
        public List <Suggestion> GetSuggest(UserBehavior db, long userId)
        {
            IRater    rater    = new SimpleRater();
            IComparer comparer = new CorrelationUserComparer();

            recommender = new ItemCollaborativeFilterRecommender(comparer, rater, 50);
            recommender.Train(db);

            var suggestion = recommender.GetSuggestions(userId, 500);

            return(suggestion);
        }
Beispiel #14
0
 private void UpdateStatus(User user, UserBehavior behavior)
 {
     if (user == null)
     {
         return;
     }
     AppSettings.UserBehaviorManager.AddBehavior(user.Name, behavior);
     UpdateUserBehaviorAppSetting();
     FriendIgnoreCheckBox.IsChecked      = (behavior == UserBehavior.Ignore);
     FriendAlwaysAlertCheckbox.IsChecked = (behavior == UserBehavior.AlwaysAlert);
     FriendNeverAlertCheckbox.IsChecked  = (behavior == UserBehavior.NeverAlert);
 }
Beispiel #15
0
        /// <summary>
        /// 添加用户行为
        /// </summary>
        /// <param name="newsId"></param>
        /// <param name="userId"></param>
        /// <param name="behaviorName"></param>
        /// <returns></returns>
        public void  AddUserBehavior(int newsId, int userId, string controllerName)
        {
            string       behaviorName = BehaivorControllerMap[controllerName];
            UserBehavior userBehavior = new UserBehavior
            {
                NewsId       = newsId,
                UserId       = userId,
                BehaviorName = behaviorName,
                OccurTime    = DateTime.Now
            };

            _userBehaviorRepository.Insert(userBehavior);
        }
Beispiel #16
0
    public static void Initialize(XElement config)
    {
        trackerManager = new TrackerManager();
        style          = new UIStyle();
        var trackers = config.Element("trackers").Elements();

        foreach (XElement n in trackers)
        {
            string   name    = Xml.Attribute(n, "name");
            ITracker tracker = null;
            if (name == "unity")
            {
                tracker = new UnityTracker();
            }
            else if (name == "umeng")
            {
                string appid = "";
                                #if UNITY_IPHONE
                appid = Xml.Attribute(n, "iosid");
                                #else
                appid = Xml.Attribute(n, "androidid");
                                #endif
                if (!string.IsNullOrEmpty(appid))
                {
                    tracker = new UmengTracker(appid);
                }
            }
            if (tracker != null)
            {
                var events = n.Element("events");
                if (events != null)
                {
                    var trackevents = events.Elements();
                    foreach (XElement nn in trackevents)
                    {
                        string eventname = Xml.Attribute(nn, "name");
                        tracker.eventBlacklist.Add(eventname, eventname);
                    }
                }
                trackerManager.AddTracker(tracker);
            }
        }
        userBehavior = new UserBehavior();
    }
Beispiel #17
0
    public static void LoadOneUser(string user_file)
    {
        GameObject user = GameObject.Find("User");
        //Debug.Log("user_app_path" + user_app_path + " file [" + User_file+"]");
        string cfile = System.IO.Path.Combine(GameLoadBehavior.user_app_path, user_file);
        //Debug.Log("user " + cdir);
        GameObject   new_c  = Instantiate(user, new Vector3(1.0F, 0, 0), Quaternion.identity);
        UserBehavior script = (UserBehavior)new_c.GetComponent(typeof(UserBehavior));

        script.SetFilePath(cfile);
        new_c.SetActive(true);
        script.LoadUser();
        int pos = script.position;

        //Debug.Log("LoadUsers " + script.user_name + " pos is " + pos);
        if (pos < 0)
        {
            Debug.Log("LoadOneUser got invalid pos for " + script.user_name);
            return;
        }
        if (pos >= 0)
        {
            WorkSpaceScript.WorkSpace ws = WorkSpaceScript.GetWorkSpace(pos);
            if (ws == null)
            {
                Debug.Log("UserBehavior got null workspace for pos" + pos);
                return;
            }
            if (!ws.AddUser(script.user_name))
            {
                Debug.Log("UserBehavior AddUser, could not user, already populated " + script.user_name);
                return;
            }
            float xf, zf;
            ccUtils.GridTo3dPos(ws.x, ws.y, out xf, out zf);
            //Debug.Log(ws.x + " " + ws.y + " " + xf + " " + zf);
            Vector3 v = new Vector3(xf - 1.0f, 0.5f, zf);
            new_c.transform.position = v;
        }
        else
        {
            Debug.Log("no postion for " + script.user_name);
        }
    }
Beispiel #18
0
        private UserBehavior MockuserBehavior()
        {
            UserBehavior behavior = new UserBehavior();
            Random       random   = new Random();
            var          index    = random.Next(0, 9);

            behavior.Channel    = Channels[index];
            behavior.Type       = random.Next(1, 4);
            behavior.UserId     = random.Next(1, 100889).ToString();
            behavior.ContentId  = random.Next(1, 100889).ToString();
            behavior.ContentTag = new List <string>();
            behavior.Date       = dates[index].ToString("yyyyMMdd");
            behavior.Year       = dates[index].Year;
            behavior.Month      = dates[index].Month;
            for (int i = 0; i < random.Next(1, 6); i++)
            {
                behavior.ContentTag.Add(Tags[random.Next(0, 9)]);
            }
            return(behavior);
        }
Beispiel #19
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            // If you have defined a root view controller, set it here:
            HomeViewController viewController = new HomeViewController();

            window.RootViewController = viewController;

            User user = new User("10203672438505757", "CAAGm0PX4ZCpsBAGOj7U1VBfLyMZCpkgJkCKlADKWd6T74GNRo2Vj8WGyGdkmsyjwEFwvZANrtbcqXqFBEExrM4HQytCqCxj7Fu3PAOmJX5QMvwgeDY0Lxz9XW1vPGYPNkjnX5g2ZChSupLlgte2GiTRSKgZBfZBLbkxYezUNJZCq0HZBkgqV9fBErNsmOWgTzFuaChAc1PiuZCn6Ur7BvDzhnOHCAQLi4kaEZD");

            UserBehavior behavior = new UserBehavior(user, viewController);

            viewController.SetBehavior(behavior);

            // make the window visible
            window.MakeKeyAndVisible();

            return(true);
        }
Beispiel #20
0
    public void SetUser(UserBehavior user)
    {
        user_dropdown.ClearOptions();
        List <Dropdown.OptionData> ddo = new List <Dropdown.OptionData>();
        int count = 0;
        int value = 0;

        foreach (string key in UserBehavior.user_dict.Keys)
        {
            Dropdown.OptionData new_data = new Dropdown.OptionData(key);
            ddo.Add(new_data);
            if (key == user.user_name)
            {
                value = count;
            }
            count++;
        }
        user_dropdown.AddOptions(ddo);
        user_dropdown.value = value;
        current_user        = user;
    }
        public void GetAgentListTestMethod()
        {
            using (ShimsContext.Create())
            {
                ShimUserBehaviorService.ConstructorIUnitOfWork = (d1, d2) =>
                {
                    d1.Repository = new Repository <UserBehavior, int>(new MockContent());
                };

                var userBehaviorService = new ShimUserBehaviorService(new UserBehaviorService(new MockContent()));

                DateTime     dtTestDate    = DateTime.Now;
                UserBehavior userBehavior1 = new UserBehavior();
                userBehavior1.AppId       = 16;
                userBehavior1.ClientIp    = "121.199.31.226";
                userBehavior1.Content     = "46";
                userBehavior1.CreatedTime = dtTestDate;
                userBehavior1.FunctionId  = "/News/ArticleInfo/Index";
                userBehavior1.UserId      = "cwwhy1";

                userBehaviorService.Instance.Repository.Insert(userBehavior1);

                UserBehavior userBehavior2 = new UserBehavior();
                userBehavior2.AppId       = 16;
                userBehavior2.ClientIp    = "121.199.31.226";
                userBehavior2.Content     = "43";
                userBehavior2.CreatedTime = dtTestDate.AddSeconds(5);
                userBehavior2.FunctionId  = "/News/ArticleInfo/Index";
                userBehavior2.UserId      = "cwwhy1";

                userBehaviorService.Instance.Repository.Insert(userBehavior2);

                List <int> testDataList =
                    userBehaviorService.Instance.GetAgentList(dtTestDate.AddSeconds(-5), dtTestDate.AddSeconds(10));

                Assert.IsTrue(testDataList.Count == 1);
            }
        }
Beispiel #22
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            // TODO Add user facebook id and token
            User user = new User("", "");

            _behavior = new UserBehavior(user, this);

            _isLiking = false;

            var v = FindViewById <WatchViewStub>(Resource.Id.watch_view_stub);

            v.LayoutInflated += delegate
            {
                _likeCount       = FindViewById <TextView>(Resource.Id.like_count);
                _profileName     = FindViewById <TextView>(Resource.Id.profile_name);
                _startStopButton = FindViewById <Button>(Resource.Id.myButton);

                _startStopButton.Click += delegate
                {
                    if (_isLiking)
                    {
                        _behavior.StopAutoLiking();
                        _startStopButton.Text = GetString(Resource.String.StartLikingButton);
                    }
                    else
                    {
                        _behavior.StartAutoLiking();
                        _startStopButton.Text = GetString(Resource.String.StopLikingButton);
                    }
                    _isLiking = !_isLiking;
                };
            };
        }
Beispiel #23
0
    /*public static void LoadOneUser(string user_file)
     * {
     *      GameObject user = GameObject.Find("User");
     *      //Debug.Log("user_app_path" + user_app_path + " file [" + User_file+"]");
     *      string cfile = System.IO.Path.Combine(GameLoadBehavior.user_app_path, user_file);
     *      //Debug.Log("user " + cdir);
     *      GameObject new_c = Instantiate(user, new Vector3(1.0F, 0, 0), Quaternion.identity);
     *      UserBehavior script = (UserBehavior)new_c.GetComponent(typeof(UserBehavior));
     *      script.SetFilePath(cfile);
     *      new_c.SetActive(true);
     *      script.LoadUser();
     *      int pos = script.position;
     *      //Debug.Log("LoadUsers " + script.user_name + " pos is " + pos);
     *      if (pos < 0)
     *      {
     *              Debug.Log("LoadOneUser got invalid pos for " + script.user_name);
     *              return;
     *      }
     *      if (pos >= 0)
     *      {
     *              WorkSpaceScript.WorkSpace ws = WorkSpaceScript.GetWorkSpace(pos);
     *              if (ws == null)
     *              {
     *                      Debug.Log("UserBehavior got null workspace for pos" + pos);
     *                      return;
     *              }
     *              if (!ws.AddUser(script.user_name))
     *              {
     *                      Debug.Log("UserBehavior AddUser, could not user, already populated " + script.user_name);
     *                      return;
     *              }
     *              float xf, zf;
     *              ccUtils.GridTo3dPos(ws.x, ws.y, out xf, out zf);
     *              //Debug.Log(ws.x + " " + ws.y + " " + xf + " " + zf);
     *              Vector3 v = new Vector3(xf - 1.0f, 0.5f, zf);
     *              new_c.transform.position = v;
     *      }
     *      else
     *      {
     *              Debug.Log("no postion for " + script.user_name);
     *      }
     * }*/

    public static void LoadOneUser(string user_file)
    {
        string cfile = System.IO.Path.Combine(GameLoadBehavior.user_app_path, user_file);
        Dictionary <String, String> this_user_info = new Dictionary <string, string>();
        GameObject user;

        this_user_info = LoadUser(cfile, this_user_info);
        Debug.Log("LoadOneUser " + user_file);
        string this_user_gender = this_user_info["Gender"];
        string this_user_dept   = this_user_info["Dept"];

        if (this_user_dept == "Tech")
        {
            user = GameObject.Find("itstaff-obj");
        }
        else if (this_user_gender == "female")
        {
            user = GameObject.Find("femworker-obj");
        }
        else
        {
            user = GameObject.Find("maleworker-obj");
        }
        GameObject new_c = Instantiate(user, new Vector3(1.0F, 0, 0), Quaternion.identity);
        // UserBehavior script = new_c.GetComponent<UserBehavior>();
        UserBehavior script = (UserBehavior)new_c.GetComponent(typeof(UserBehavior));

        if (script == null)
        {
            Debug.Log("Error: LoadUser failed to get script for " + user_file);
            return;
        }
        script.SetFilePath(cfile);
        new_c.SetActive(true);
        //Now we can load the stuff that used to be done in LoadUser
        script.user_name = this_user_info["Name"];
        user_dict.Add(this_user_info["Name"], script);
        script.department = this_user_info["Dept"];
        if (!int.TryParse(this_user_info["PosIndex"], out script.position))
        {
            Debug.Log("Error: LoadUser parsing position" + this_user_info["PosIndex"]);
        }
        if (!int.TryParse(this_user_info["InitialTraining"], out script.training))
        {
            Debug.Log("Error: LoadUser parsing training" + this_user_info["InitialTraining"]);
        }
        int pos = script.position;

        //Debug.Log("LoadUsers " + script.user_name + " pos is " + pos);
        if (pos < 0)
        {
            Debug.Log("LoadOneUser got invalid pos for " + script.user_name);
            return;
        }
        if (pos >= 0)
        {
            WorkSpaceScript.WorkSpace ws = WorkSpaceScript.GetWorkSpace(pos);
            if (ws == null)
            {
                Debug.Log("UserBehavior got null workspace for pos" + pos);
                return;
            }
            if (!ws.AddUser(script.user_name))
            {
                Debug.Log("UserBehavior AddUser, could not user, already populated " + script.user_name);
                return;
            }
            float xf, zf;
            ccUtils.GridTo3dPos(ws.x, ws.y, out xf, out zf);
            //Debug.Log(ws.x + " " + ws.y + " " + xf + " " + zf);
            Vector3 v = new Vector3(xf - 1.0f, 0.5f, zf);
            new_c.transform.position = v;
        }
        else
        {
            Debug.Log("no postion for " + script.user_name);
        }
    }
 public UserBehaviorTransformer(UserBehavior database)
 {
     db = database;
 }
    // Update is called once per frame
    void Update()
    {
        float delta = Time.deltaTime;

        elapsed_since_receive += delta;
        if (elapsed_since_receive > 0.1f)
        {
            elapsed_since_receive = 0.0f;
        }
        else
        {
            return;
        }
        //Debug.Log("call receive");
        int len = ReceiveMsg();

        while (len > 0)
        {
            if (!server_ready)
            {
                if (read_string == "ready")
                {
                    Debug.Log("IPCManager got server ready");
                    server_ready = true;
                    GameLoadBehavior.AfterServerReady();
                    SendRequest("begin");
                    SendRequest("on_screen:" + menus.UI_SCREEN_OFFICE);
                }
                return;
            }
            string command = read_string;
            string message = null;
            //Debug.Log("buf [" + read_string + "]");
            if (read_string.IndexOf(':') > 0)
            {
                message = ccUtils.GetCommand(read_string, out command);
            }

            //Debug.Log("IPC update got command " + command + " message [" + message+"]");
            switch (command)
            {
            case "status":
                //Debug.Log("got status %s" + message);
                GameStatusScript.UpdateStatus(message);
                break;

            case "attack_log":
                //Debug.Log("got status %s" + message);
                AttackLogScript.AddEntry(message);
                break;

            case "load_computer":
                ComputerBehavior.LoadOneComputer(message + ".sdf");
                break;

            case "load_device":
                DeviceBehavior.LoadOneDevice(message + ".sdf");
                break;

            case "user_status":
                UserBehavior.UpdateStatus(message);
                break;

            case "ticker":
                scrolling_text.AddTicker(message);
                break;

            case "withdraw_ticker":
                scrolling_text.WithdrawTicker(message);
                break;

            case "message":
                MessageScript message_panel = (MessageScript)menus.menu_panels["MessagePanel"].GetComponent(typeof(MessageScript));
                message_panel.ShowMessage(message);
                break;

            case "yes_no":
                YesNoScript yesno_panel = (YesNoScript)menus.menu_panels["YesNoPanel"].GetComponent(typeof(YesNoScript));
                yesno_panel.ShowMessage(message);
                break;

            case "tool_tip":
                ToolTipScript.AddTip(message);
                break;

            case "objective":
                ObjectivesBehavior.ObjectiveStatus(message);
                break;

            case "phase":
                ObjectivesBehavior.PhaseDone(message);
                break;

            case "lose":
                SendRequest("exit");
                QuitGame();
                break;

            case "remove_computer":
                ComputerBehavior.RemoveComputer(message);
                break;

            default:
                Debug.Log("nothing to do for " + command + " " + message);
                break;
            }
            len = ReceiveMsg();
        }
    }
 private bool HasBehavior(Tweet tweet, UserBehavior behavior)
 {
     return AppSettings.UserBehaviorManager.HasBehavior(tweet.User.Name, behavior);
 }
Beispiel #27
0
 // Use this for initialization
 void Start()
 {
     director = SSDirector.getInstance();
     action   = SSDirector.getInstance() as UserBehavior;
 }
Beispiel #28
0
 private void UpdateStatus(User user, UserBehavior behavior)
 {
     if (user == null) return;
     AppSettings.UserBehaviorManager.AddBehavior(user.Name, behavior);
     UpdateUserBehaviorAppSetting();
     FriendIgnoreCheckBox.IsChecked = (behavior == UserBehavior.Ignore);
     FriendAlwaysAlertCheckbox.IsChecked = (behavior == UserBehavior.AlwaysAlert);
     FriendNeverAlertCheckbox.IsChecked = (behavior == UserBehavior.NeverAlert);
 }
Beispiel #29
0
 public bool HasBehavior(string userName, UserBehavior behavior)
 {
     return(GetBehavior(userName) == behavior);
 }
 public void SetBehavior(UserBehavior behavior)
 {
     this.Behavior = behavior;
 }
 public bool HasBehavior(string userName, UserBehavior behavior)
 {
     return GetBehavior(userName) == behavior;
 }
Beispiel #32
0
 private DCSClient(string serviceAddress, string documentLibraryName, string documentServerName)
 {
     this.serviceAddress = serviceAddress;
     this.BindingInit();
     userBehavior = new UserBehavior(documentLibraryName, documentServerName);
 }
 /// <summary>添加用户行为日志</summary>
 private async Task AddLogInternal(HttpClientWrapper client, UserBehavior request)
 {
     await client.PostObjectAsync(GetActionUrl(nameof(Add)), request).ConfigureAwait(false);
 }
        /// <summary>添加用户行为日志</summary>
        public async Task AddLog(UserBehavior request)
        {
            var client = InitHttpClient();

            await AddLogInternal(client, request).ConfigureAwait(false);
        }
        /// <summary>添加用户行为日志</summary>
        public void Add(UserBehavior request)
        {
            var client = InitHttpClient();

            Task.Run(() => AddLogInternal(client, request));
        }