现在有很多的投票活动不在是单纯的采取微信投票,而是采用app的形式来进行投票,那么你如果想要进行投票,你就必须要下载他们的app才能够进行投票,所以最近大家就在烦恼了,说这样的app怎么刷投票,没有办法能够解决这个问题吗?其实app怎么刷投票是可以解决的,那就是用到微信刷投票app来进行操作,那么如果大家目前还没有找到微信刷投票app的话,这里我就先把我自己目前在用的一款刷投票app软件的代码分享给大家,大家套用下就可以出现的软件了
/// <summary>
/// 抽象观察类
/// </summary>
abstract public class Observer{
public abstract void Update();
}
/// <summary>
/// 具体观察类
/// </summary>
public class Concreteobserver:Observer{
private string name;
private string observerState;
private ConcreteSubject subject;
public Concreteobserver(ConcreteSubject subject,string name){
this.subject=subject;
this.name= name;
}
public override void Update(){
observerState=subject.GetState();
Console.write("观察者{0}的新状态是{1}",name,observerState);
}
}
/// <summary>
/// 抽象主题类
/// </summary>
abstract public class Subject(){
private List<observer> observers = new List<observer>() ;
public void Attach(Observer observer){
observers.Add(Observer);
}
public void Detach(Observer Observer){
observers.Remove(Observer);
}
public void NotifyObservers(){
foreach(Observer o in observers){
o.Update();
}
}
}
/// <summary>
/// 具体主题类
/// </summary>
public class ConcreteSubject:Subject{
private string subjectState;
public string SubjectState{
get{return subjectstate;}
set{subjectstrate=value;}
}
public void GetState(){
return subjectstate;
}
}
//client端
static void Main(string[] args)
{
ConcreteSubject c = new ConcreteSubject();
Concreteobserver o1 = new Concreteobserver(c,"X");
Concreteobserver o2 = new Concreteobserver(c,"Y");
Concreteobserver o3 = new Concreteobserver((c,"Z");
c.Attach(o1);
c.Attach(o2);
c.Attach(o3);
c.subjectstate="abc";
c.Nofify();
Console.ReadLine();
}
版权申明:本篇文章属于原创,转载请注明出自微信投票网。原文地址: http://www.aivote.com/13160.html