Exemplo n.º 1
0
        private async void Start_Click(object sender, RoutedEventArgs e)
        {
            int totalimg = q.Count;

            OverallProg.Maximum = totalimg;
            OverallProg.Minimum = 0;

            while (q.Count > 0)
            {
                try
                {
                    goset = (setting)q.Dequeue();                                                       //do not update goset with new value if an exposure was not taken due to failure
                    MainCamera.SetSetting(PropertyID.Tv, TvValues.GetValue(goset.getEXP()).IntValue);   // set exposure
                    MainCamera.SetSetting(PropertyID.Av, AvValues.GetValue(goset.getAP()).IntValue);    // set aperture
                    MainCamera.SetSetting(PropertyID.ISO, ISOValues.GetValue(goset.getISO()).IntValue); // set ISO sensitivity
                    MainCamera.TakePhotoAsync();                                                        // capture image
                    statustext.Text = "Capturing image " + (totalimg - q.Count) + " of " + totalimg;
                }
                catch (Exception ex)
                {
                    ReportError(ex.Message, false);
                    break; // stop while loop if error arises
                }
                finally
                {
                    OverallProg.Value = totalimg - q.Count;
                    await WaitAsynchronously();
                }
            }
            statustext.Text = "Complete";
        }
Exemplo n.º 2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            int count = 0;
            var ofd   = new Microsoft.Win32.OpenFileDialog()
            {
                Filter = "Text Files (*.txt)|*.txt"
            };
            var result = ofd.ShowDialog();

            if (result == false)
            {
                return;
            }
            //ofd.FileName;

            try
            {
                Assembly curr_assembly = Assembly.GetExecutingAssembly();

                StreamReader readtxt = new StreamReader(ofd.FileName);  //access emebed resource text file
                while (readtxt.Peek() >= 0)                             // read line by line until none are left
                {
                    string[] TempParam = readtxt.ReadLine().Split(' '); // parse strings using space as a delimiter
                    foreach (string param in TempParam)                 // iterate through each element of parsed string array
                    {
                        if (count == 0)
                        {
                            EXPtemp = param; // store first element of line as temporary exposure
                            if (EXPtemp == "20\"" || EXPtemp == "10\"" || EXPtemp == "6\"" || EXPtemp == "0\"3" || EXPtemp == "1/6" || EXPtemp == "1/10" || EXPtemp == "1/20")
                            {
                                EXPtemp += " (1/3)"; // append (1/3) to the expsoures that require it
                            }
                            count++;                 // increment count to access next value (aperture)
                        }
                        else if (count == 1)
                        {
                            APtemp = param; // store second element of line as temporary aperture size
                            if (APtemp == "3.5" || APtemp == "13")
                            {
                                APtemp += " (1/3)"; // append (1/3) to the fstops that require it
                            }
                            count++;                // increment count to access next value (ISO)
                        }
                        else if (count == 2)
                        {
                            ISOtemp = "ISO " + param;                                                               // store last element of line as a temporary ISO
                            count   = 0;                                                                            // reset count to 0 so that the first element of the NEXT line will be accessed
                            setting setf = new setting(EXPtemp, ISOtemp, APtemp);                                   // create new class instance for each photo to be taken
                            q.Enqueue(setf);                                                                        // queue class instance
                            QueueList.Text += EXPtemp + "     " + APtemp + "     " + ISOtemp + Environment.NewLine; // display queue in textbox
                        }
                    }
                }
            }
            catch
            {
                //placeholder until I find out what I should do
            }
        }
Exemplo n.º 3
0
        private void Queue_Click(object sender, RoutedEventArgs e)
        {
            setting set = new setting(EXPtemp, ISOtemp, APtemp); // create new class instance for each photo to be taken

            q.Enqueue(set);                                      // queue class instance
            QueueList.Text += ((string)TvCoBox.SelectedItem) + "     " + ((string)AvCoBox.SelectedItem) + "     " + ((string)ISOCoBox.SelectedItem) + Environment.NewLine;
            // display queued setting in textbox
        }