Exemplo n.º 1
0
        internal void SetServerBox(string _msg)
        {
            string          text = _msg;
            SetInfoCallback d    = new SetInfoCallback(add_server_text);

            this.Invoke(d, new Object[] { text });
        }
Exemplo n.º 2
0
        //append text to the client box
        public void SetClientBox(string msg)
        {
            var text     = msg;
            var callback = new SetInfoCallback(AddClientText);

            this.Invoke(callback, new object[] { text });
        }
Exemplo n.º 3
0
        internal void SetInfoBox(string p)
        {
            string          text = p;
            SetInfoCallback d    = new SetInfoCallback(add_text);

            this.Invoke(d, new Object[] { text });
        }
Exemplo n.º 4
0
        //append text to the server box
        public void SetServerBox(string msg)
        {
            var             text     = msg;
            SetInfoCallback callback = new SetInfoCallback(AddServerText);

            this.Invoke(callback, new object[] { text });
        }
Exemplo n.º 5
0
        public void SetInfoBox(String _msg)
        {
            string          text = _msg;
            SetInfoCallback d    = new SetInfoCallback(add_text);

            this.Invoke(d, new object[] { text });
        }
Exemplo n.º 6
0
 private void SetInfo(string text)
 {
     if (this.lbInfo.InvokeRequired)
     {
         try
         {
             SetInfoCallback d = new SetInfoCallback(SetInfo);
             this.Invoke(d, new object[] { text });
         }
         catch (ObjectDisposedException oe)
         {
             MessageBox.Show(oe.ToString());
         }
     }
     else
     {
         if (text.Contains("Client Amount"))
         {
             this.lbInfo.Items.Clear();
         }
         this.lbInfo.Items.Add(text);
         this.lbInfo.Items.Add("");
         for (int i = 0; i < Global.getClientCount(); ++i)
         {
             this.lbInfo.Items.Add((i + 1) + ": " + Global.getTcpClient(i).Client.RemoteEndPoint.ToString());
         }
     }
 }
Exemplo n.º 7
0
        public void SetFrameBox(String _msg)
        {
            string          text = _msg;
            SetInfoCallback d    = new SetInfoCallback(setFrameNumber);

            this.Invoke(d, new Object[] { text });
        }
Exemplo n.º 8
0
 public void SetInfoBox(String _msg)
 {
     string text = _msg;
     SetInfoCallback d = new SetInfoCallback(add_text);
     this.Invoke(d, new object[] { text });
 }
Exemplo n.º 9
0
 /// <summary>
 /// Setea la info en modo thread safe
 /// </summary>
 /// <param name="value"></param>
 /// <param name="text"></param>
 private void SetInfoState(bool value, string text)
 {
     if (this.InvokeRequired)
     {
         SetInfoCallback d = new SetInfoCallback(SetInfoState);
         this.Invoke(d, new object[] { value, text });
     }
     else
     {
         this.Items["information"].Visible = value;
         this.Items["information"].Text = text;
     }
 }
Exemplo n.º 10
0
        private bool SetInfoOptions(string field, List <info_item> options, bool isAsync, SetInfoCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.profile.setInfoOptions" }
            };

            Utilities.AddRequiredParameter(parameterList, "field", field);

            var list = new List <string>();

            foreach (var item in options)
            {
                var dict = new Dictionary <string, string> {
                    { "label", item.label },
                    { "sublabel", item.sublabel },
                    { "link", item.link },
                    { "image", item.image },
                    { "description", item.description }
                };
                list.Add(JSONHelper.ConvertToJSONAssociativeArray(dict));
            }

            Utilities.AddJSONArray(parameterList, "options", list);

            if (isAsync)
            {
                SendRequestAsync <profile_setInfoOptions_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state);
                return(true);
            }

            var response = SendRequest <profile_setInfoOptions_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));

            return(response == null ? false : response.TypedValue);
        }
Exemplo n.º 11
0
        private bool SetInfo(string title, int type, List <info_field> info_fields, long uid, bool isAsync, SetInfoCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.profile.setInfo" }
            };

            Utilities.AddRequiredParameter(parameterList, "title", title);
            Utilities.AddRequiredParameter(parameterList, "type", type);

            var fieldList = new List <string>();

            foreach (var field in info_fields)
            {
                var itemList = new List <string>();
                foreach (var item in field.items.info_item)
                {
                    var itemDict = new Dictionary <string, string> {
                        { "label", item.label },
                        { "sublabel", item.sublabel },
                        { "link", item.link },
                        { "image", item.image },
                        { "description", item.description }
                    };
                    itemList.Add(JSONHelper.ConvertToJSONAssociativeArray(itemDict));
                }

                var fieldDict = new Dictionary <string, string> {
                    { "field", field.field },
                    { "items", JSONHelper.ConvertToJSONArray(itemList) }
                };
                fieldList.Add(JSONHelper.ConvertToJSONAssociativeArray(fieldDict));
            }

            Utilities.AddJSONArray(parameterList, "info_fields", fieldList);
            Utilities.AddRequiredParameter(parameterList, "uid", uid);

            if (isAsync)
            {
                SendRequestAsync <profile_setInfo_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state);
                return(true);
            }

            var response = SendRequest <profile_setInfo_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));

            return(response == null ? false : response.TypedValue);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Specifies the objects for a field for an application info section.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Session.UserId = Constants.UserId;
 ///     var item1 = new info_item { link = "www.claritycon.com", label = "SetInfoOptions test 1" };
 ///     api.Profile.SetInfoOptionsAsync("Test Field", new List&lt;info_item&gt;() { item1 }, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="field">The title of the field.</param>
 /// <param name="options">A List of items for a thumbnail, including a label and a link, and optionally contains image, description, and sublabel items.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>
 /// <returns>This method returns true if the available items for a filed in an application info section was successfully set.</returns>
 public void SetInfoOptionsAsync(string field, List <info_item> options, SetInfoCallback callback, Object state)
 {
     SetInfoOptions(field, options, true, callback, state);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Configures an application info section that the specified user can install on the Info tab of her profile.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Session.UserId = Constants.UserId;
 ///     var item = new info_item();
 ///     item.label = "Test info item";
 ///     item.link = "www.claritycon.com";
 ///     var field = new info_field();
 ///     field.items = new info_fieldItems();
 ///     field.items.info_item.Add(item);
 ///     field.field = "Test field";
 ///     api.Profile.SetInfoAsync("Test Field", 5, new List&lt;info_field&gt;() { field }, Constants.UserId, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="title">The title or header of the application info section. </param>
 /// <param name="type">Specify 1 for a text-only field-item configuration or 5 for a thumbnail configuration.</param>
 /// <param name="info_fields">A List of elements comprising an application info section, including the field (the title of the field) and an array of info_item objects (each object has a label and a link, and optionally contains image, description, and sublabel fields).</param>
 /// <param name="uid">The user ID of the user adding the application info section. </param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>
 /// <returns>This method returns true if the application info section was successfully set.</returns>
 public void SetInfoAsync(string title, int type, List <info_field> info_fields, long uid, SetInfoCallback callback, Object state)
 {
     SetInfo(title, type, info_fields, uid, true, callback, state);
 }