@startuml
!theme plain
skinparam conditionStyle InsideDiamond
|客户端界面|
start
while (界面关闭?) is (no)
fork
    partition 创建客户端 #pink
        if (点击tab栏创建客户端) then (yes)
            : 创建一个客户端线程对象; 
            note right 
                记为C
            end note
            : 将该线程对象添加到线程指针列表中;
        else (no)
        endif
    }
fork again
    partition 关闭客户端 #pink
    if (点击关闭按钮) then (yes)
            : 关闭选中的客户端线程;
            : 从线程列表中将其去除;
        else (no)
        endif
    }
fork again 
    partition 连接到服务端 #pink
        if (点击连接按钮) then (yes)
            : 弹出配置窗口;
            : 输入服务端IP地址、端口号;
            : 连接到服务端;
        else (no)
        endif
    }
fork again 
    partition 发送消息 #pink
        : 输入待发送的消息;
        if  (正在发送消息) then (no)
            if (点击发送按钮) then (yes)
                : 发送消息;
            else (no)
            endif
        else (yes)
        endif
    }
fork again 
    partition 断开连接 #pink
        if (已连接到服务器) then (yes)
            if (点击断开连接) then (yes)
                : 与服务端断开连接;
            else (no)
            endif
        else (no)
        endif
    }
end fork
partition UI渲染 #pink
    : 显示当前选中的客户端的主界面;
}
end while (yes)
if (客户端线程列表为空？) then (yes)
else (no)
    : 将所有线程关闭;
endif
stop
@enduml
