Beispiel #1
0
        static void Main(string[] args)
        {
            var collector = new DataCollector();

            var consolePresenter         = new ConsolePresenter();
            var filePresenter            = new FilePresenter(@"d:\temp\persons.txt");
            var shoutingConsolePresenter = new ShoutingConsolePresenter();

            var multiplePresenter = new MultiplePresenter(new List <IPresenter> {
                shoutingConsolePresenter, consolePresenter, filePresenter
            });

            while (true)
            {
                Console.Write("Enter your name: ");
                var name = Console.ReadLine();

                Console.Write("Enter your age: ");
                var age = int.Parse(Console.ReadLine());

                collector.CollectData(name, age);

                Console.Write("Add more? (y/n) ");
                var answer = Console.ReadKey();
                Console.WriteLine();

                if (answer.Key == ConsoleKey.N)
                {
                    break;
                }
            }
            collector.PresentData(multiplePresenter);

            Console.ReadLine();
        }
Beispiel #2
0
 public FileView()
 {
     InitializeComponent();
     this.TabText        = "项目";
     treeView1.LabelEdit = true;
     presener            = new FilePresenter(this);
     CloseButtonVisible  = false;
 }
Beispiel #3
0
 public static void Register(FileControl Input1, FilePresenter Input2)
 {
     if (FFInstanceContainer.ContainsKey(Input1))
     {
         FFInstanceContainer[Input1] = Input2;
     }
     else
     {
         FFInstanceContainer.Add(Input1, Input2);
     }
 }
Beispiel #4
0
 public static FileControl GetFileControlInstance(FilePresenter Input)
 {
     if (FFInstanceContainer.FirstOrDefault((KV) => KV.Value == Input) is KeyValuePair <FileControl, FilePresenter> KV)
     {
         return(KV.Key);
     }
     else
     {
         return(null);
     }
 }
Beispiel #5
0
        public static void UnRegister(FilePresenter Input)
        {
            if (GetFileControlInstance(Input) is FileControl ControlInstance)
            {
                if (GetThisPCInstance(ControlInstance) is ThisPC PCInstance)
                {
                    TFInstanceContainer.Remove(PCInstance);
                }

                if (FFInstanceContainer.ContainsKey(ControlInstance))
                {
                    FFInstanceContainer.Remove(ControlInstance);
                }

                if (FSInstanceContainer.ContainsKey(ControlInstance))
                {
                    FSInstanceContainer.Remove(ControlInstance);
                }
            }
        }
Beispiel #6
0
 public FileController(IHostingEnvironment hostingEnvironment, IFile file) : base(hostingEnvironment) //Constructor
 {
     fp = new FilePresenter(file, hostingEnvironment);
 }