nature_net.user_controls.item_generic_v2.ToString C# (CSharp) Метод

ToString() публичный Метод

public ToString ( ) : string
Результат string
        public override string ToString()
        {
            string id = "-1";
            if (this.Tag != null)
                id = (Convert.ToInt32(this.Tag)).ToString();
            string c = "";
            if (this.description.Text != null)
                c = this.description.Text;
            string source = "";
            if (this.user_info_icon.Source != null)
                source = this.user_info_icon.Source.ToString();
            else
                if (this.avatar.Source != null)
                    source = this.avatar.Source.ToString();
            string result = id + ";" + source + ";" + this.title.Text +
                ";" + this.txt_level2.Text + ";" + this.user_info_name.Text + ";" + c + ";" + this.number.Text + ";" + this.num_likes.Content.ToString();
            return result;
        }

Usage Example

        private bool start_drag(item_generic_v2 item, TouchEventArgs e)
        {
            if (item == null) return false;
            ContentControl cursorVisual = new ContentControl();
            cursorVisual.Content = item.get_clone();
            cursorVisual.Style = (FindResource("CursorStyle") as Style);

            List<TouchDevice> devices = new List<TouchDevice>();
            devices.Add(e.TouchDevice);
            foreach (TouchDevice touch in item.TouchesCapturedWithin)
            {
                if (touch != e.TouchDevice)
                {
                    devices.Add(touch);
                }
            }

            if (item.Tag == null) return false;

            //string avatar = "";
            //if (item.avatar.Source != null)
            //    avatar = item.avatar.Source.ToString();
            //string data = drag_prefix + ";" + ((int)item.Tag).ToString() + ";" + avatar + ";" +
            //    (string)item.title.Text + ";" + item.description.Text + ";" + "" + ";" + "";
            string data = drag_prefix + ";" + item.ToString();
            log.WriteInteractionLog(4, "start dragging the listbox item: " + item.ToString(), e.TouchDevice);
            Microsoft.Surface.Presentation.SurfaceDragCursor startDragOkay =
                Microsoft.Surface.Presentation.SurfaceDragDrop.BeginDragDrop(
                  this._list,                 // The SurfaceListBox object that the cursor is dragged out from.
                  item,                       // The item object that is dragged from the drag source.
                  cursorVisual,               // The visual element of the cursor.
                  data,                       // The data associated with the cursor.
                  devices,                    // The input devices that start dragging the cursor.
                  DragDropEffects.Copy);      // The allowed drag-and-drop effects of the operation.

            return (startDragOkay != null);
        }