Beispiel #1
0
 public static void SomeMethod()
 {
     Threading.Thread t = new Threading.Thread(() =>
     {
         try {
             while (true)
             {
                 dynamic server = new NamedPipeServerStream("Closer", PipeDirection.InOut, -1);
                 server.WaitForConnection();
                 if (!server.IsConnected)
                 {
                     return;
                 }
                 dynamic reader  = new IO.StreamReader(server);
                 dynamic casetxt = reader.ReadToEnd();
                 server.Close();
                 RootForm.Invoke(() =>
                 {
                     if (casetxt == "End")
                     {
                         System.Environment.Exit(0);
                     }
                 });
             }
         } catch (Exception ex) {
             // try/catch required in all child threads as error silently ends app.
             // log it...
         }
     });
     t.IsBackground = true;
     t.Name         = "EnderListener";
     t.Start();
 }
Beispiel #2
0
 /// <summary>
 /// Decodes the available IFF chunks
 /// </summary>
 /// <param name="reader"></param>
 internal void DecodeRootForm(DjvuReader reader)
 {
     RootForm = DjvuParser.GetRootForm(reader, null, this);
     RootForm.Initialize(reader);
     foreach (IDjvuNode chunk in RootForm.Children)
     {
         chunk.Initialize(reader);
     }
 }
Beispiel #3
0
        public string GetResult()
        {
            int count = 0;
            for(int i = 2; i <= 10000; i++)
            {
                var r = new RootForm(i);
                if (r.IsOddPeriod)
                    count++;
            }

            return count.ToString();
        }
Beispiel #4
0
        public object GetResult()
        {
            int count = 0;

            for (int i = 2; i <= 10000; i++)
            {
                var r = new RootForm(i);
                if (r.IsOddPeriod)
                {
                    count++;
                }
            }

            return(count);
        }
Beispiel #5
0
 private void newDefinitionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this is frm01Connect)
     {
         Common.InitServerDefinition();
         ((frm01Connect)this).loadData();
     }
     else
     {
         RootForm.MoveAt(1, this);
         System.Threading.Thread.Sleep(200);
         Common.InitServerDefinition();
         System.Threading.Thread.Sleep(200);
         RootForm.loadData();
     }
 }
Beispiel #6
0
        private void loadDefinitionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Common.DeserializeDefinition(openFileDialog1.FileName);

                if (this is frm01Connect)
                {
                    ((frm01Connect)this).MoveAt(12, null);
                }
                else
                {
                    RootForm.MoveAt(12, this);
                    //RootForm.loadData();
                }
            }
        }
Beispiel #7
0
 void btnClose_Click(object sender, EventArgs e)
 {
     if (_isRunning)
     {
         DialogResult result = MessageBox.Show("Are you sure you want to cancel data generation?", "SharePoint Data Generation", MessageBoxButtons.YesNo);
         if (result == System.Windows.Forms.DialogResult.Yes)
         {
             RootForm.MoveAt(12, this);
             this.Hide();
         }
     }
     else
     {
         RootForm.MoveAt(12, this);
         this.Hide();
     }
 }
Beispiel #8
0
        /// <summary>
        /// Builds the list of pages
        /// </summary>
        internal void BuildPageList()
        {
            if (Pages == null)
            {
                Pages = new List <IDjvuPage>();
            }

            switch (RootForm.ChunkType)
            {
            case ChunkType.Djvm:
            {
                DjvmChunk          root       = (DjvmChunk)RootForm;
                Queue <ITH44Chunk> thumbnails = new Queue <ITH44Chunk>();
                foreach (IThumChunk t in root.Thumbnails)
                {
                    foreach (ITH44Chunk th in t.Children)
                    {
                        thumbnails.Enqueue(th);
                    }
                }

                foreach (DjvuChunk page in root.Pages)
                {
                    AddPage(thumbnails, page);
                }
            }
            break;

            case ChunkType.Djvu:
                AddPage(null, (DjvuChunk)RootForm);
                break;

            case ChunkType.BM44Form:
            case ChunkType.PM44Form:
                AddPage(RootForm);
                break;

            default:
                throw new DjvuFormatException($"Unsupported root form type {RootForm.GetType()}");
            }

            OnPropertyChanged(nameof(Pages));
        }
Beispiel #9
0
 void btnNext_Click(object sender, EventArgs e)
 {
     preventCloseMessage = true;
     RootForm.MoveNext(this);
 }
Beispiel #10
0
 void btnBack_Click(object sender, EventArgs e)
 {
     preventCloseMessage = true;
     RootForm.MovePrevious(this);
 }
Beispiel #11
0
 public RootController(RootForm rootForm)
 {
     RootForm = rootForm;
 }