Example #1
0
 public AdminForm(InitForm master, MergeSortTask server, long id)
 {
     this.server = server;
     this.master = master;
     this.id     = id;
     InitializeComponent();
 }
Example #2
0
 /**
  *   Подключает клиент к серверу. Создает файл настроек, если он не был создан ранее.
  *   В случае отсутвия подключения к серверу, возвращает исходное состояние.
  */
 private void btnConnect_Click(object sender, EventArgs e)
 {
     if (channel == null && txtAddr.Text.Trim().Length != 0)
     {
         channel = new TcpChannel();
         ChannelServices.RegisterChannel(channel, false);
         server = (MergeSortTask)Activator.GetObject(typeof(MergeSortTask), txtAddr.Text);
         try
         {
             if (!configured)
             {
                 id = server.joinToServer();
                 createSettingsFile("settings.tid", id);
             }
             server.setManagingClient(id);
             new AdminForm(this, server, id).Show();
             Hide();
         }
         catch (SystemException)
         {
             MessageBox.Show("Сервер недоступен");
             closeConnetction();
         }
     }
 }
Example #3
0
 public WorkerForm(InitForm master, MergeSortTask server, long id)
 {
     this.master = master;
     this.server = server;
     this.id     = id;
     InitializeComponent();
     isLostConnection = false;
 }
Example #4
0
        static void Main(string[] args)
        {
            var   result = PrintMenu();
            ITask task;

            switch (result)
            {
            case 1:
                task = new QuickSortTask();
                break;

            case 2:
                task = new MergeSortTask();
                break;

            case 3:
                task = new CountingSortTask();
                break;

            case 4:
                task = new RadixSortTask();
                break;

            case 5:
                task = new BucketSortTask();
                break;

            default:
                return;
            }

            Console.WriteLine("Random Array.");
            var t = new TestRunner(task, $"data/0.random/");

            t.Run();

            Console.WriteLine("Digits Array.");
            t = new TestRunner(task, $"data/1.digits/");
            t.Run();

            Console.WriteLine("Sorted Array.");
            t = new TestRunner(task, $"data/2.sorted/");
            t.Run();

            Console.WriteLine("Reverse Array.");
            t = new TestRunner(task, $"data/3.revers/");
            t.Run();

            Console.WriteLine("Completed. Press ENTER to exit.");
            Console.ReadLine();
        }
Example #5
0
 internal void closeConnetction()
 {
     if (channel != null)
     {
         if (server != null)
         {
             try
             {
                 server.freeManage(id);
             }
             catch (SystemException) { }
             server = null;
         }
         ChannelServices.UnregisterChannel(channel);
         channel = null;
     }
 }