コード例 #1
0
        public Presenter(IView view)
        {
            this.view = view;
            // foldrrrr = new ZippedFolder("C:\\Users\\Илья\\Desktop\\huyi.zip");
            //   List<string> asss = foldrrrr.GetAllFiles();
            //   ZippedFile.OpenZipFile("C:\\Users\\Илья\\Desktop\\huyi.zip", asss[0]);
            view.startDownloadForm      += new EventHandler(downloadForm);
            view.decryptClicked         += new EventHandler(decryptClickedRealize);
            view.encryptClicked         += new EventHandler(encryptClickedRealize);
            view.asynkTaskSearchClicked += new EventHandler(asyncTaskSearck);
            view.searchFilesByUserInput += new EventHandler(SearchFilesByInput);
            view.TaskSearchClicked      += new EventHandler(tasksearch);
            view.foreachSearch          += new EventHandler(parallelsearch);
            view.defaultSearck          += new EventHandler(stansartSearch);
            view.openButtonClicked      += new EventHandler(startFileButton);
            view.doubleclickOpen        += new EventHandler(openFile);
            view.selectedIndexChanged   += new EventHandler(changedVsyoTaki);
            view.menu10     += new EventHandler(MENU10);
            view.menu9      += new EventHandler(MENU9);
            view.menu8      += new EventHandler(MENU8);
            view.menu7      += new EventHandler(MENU7);
            view.menu6      += new EventHandler(MENU6);
            view.menu5      += new EventHandler(MENU5);
            view.menu4      += new EventHandler(MENU4);
            view.menu3      += new EventHandler(MENU3);
            view.menu2      += new EventHandler(MENU2);
            view.menu1      += new EventHandler(MENU1);
            view.updateForm += new EventHandler(updateTheMenu);

            CesarCrypt   = new crypt();
            CesarEncrypt = new encrypt();
            visitor      = new Md5Hash();
            asyncArch    = new asyncTaskZip();
            taskArch     = new taskZip();
            foreachArch  = new foreachZip();
            regArch      = new regularZip();
            s            = new Strategy(new asynctaskSearch());
        }
コード例 #2
0
        public Form1()
        {
            w = new FileSystemWatcher();
            InitializeComponent();

            Presenter pres = new Presenter(this);


            visitor      = new Md5Hash();
            CesarCrypt   = new crypt();
            CesarEncrypt = new encrypt();

            asyncArch   = new asyncTaskZip();
            taskArch    = new taskZip();
            foreachArch = new foreachZip();
            regArch     = new regularZip();

            s = new Strategy(new defaultSearch());

            fi = new WorkWithFiles();
            ImageList imageListSmall = new ImageList();

            imageListSmall.Dispose();
            imageListSmall.Images.Add(Bitmap.FromFile("C:\\file.ico"));
            imageListSmall.Images.Add(Bitmap.FromFile("C:\\papka.ico"));
            imageListSmall.Images.Add(Bitmap.FromFile("C:\\intro-external-drive.png"));
            imageListSmall.Images.Add(Bitmap.FromFile("C:\\zip.png"));
            imageListSmall.ImageSize = new Size(32, 32);
            listView1.LargeImageList = imageListSmall;
            var drives = FolderMethods.getDrInfo();

            foreach (var i in drives)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.ImageIndex = 2;
                lvi.Text       = i.Name;
                lvi.Tag        = "directory";
                listView1.Items.Add(lvi);
            }
            contextMenu = new System.Windows.Forms.ContextMenu();
            menuItem1   = new MenuItem("&Copy", new EventHandler(menu1_click));
            menuItem2   = new MenuItem("&Cut", new EventHandler(menu3_click));
            menuItem3   = new MenuItem("&Delete", new EventHandler(menu2_click));
            menuItem4   = new MenuItem("&Rename", new EventHandler(menu4_click));
            menuItem5   = new MenuItem("&Archive", new EventHandler(menu5_click));
            menuItem6   = new MenuItem("&Archive parralelfreach", new EventHandler(menu6_click));
            menuItem7   = new MenuItem("&Archive parralelTask", new EventHandler(menu7_click));
            menuItem8   = new MenuItem("&Archive Task async", new EventHandler(menu8_click));
            menuItem9   = new MenuItem("&Statictic", new EventHandler(menu9_click));
            menuItem10  = new MenuItem("&MD5 hash", new EventHandler(menu10_click));
            contextMenu.MenuItems.Add(menuItem1);
            contextMenu.MenuItems.Add(menuItem2);
            contextMenu.MenuItems.Add(menuItem3);
            contextMenu.MenuItems.Add(menuItem4);
            contextMenu.MenuItems.Add(menuItem5);
            contextMenu.MenuItems.Add(menuItem6);
            contextMenu.MenuItems.Add(menuItem7);
            contextMenu.MenuItems.Add(menuItem8);
            contextMenu.MenuItems.Add(menuItem9);
            contextMenu.MenuItems.Add(menuItem10);
            richTextBox2.Text = "eat";
        }