Ejemplo n.º 1
0
 public MyAlertViewDelegate(OptionsViewController controller)
 {
     currentViewContorller = controller;
 }
Ejemplo n.º 2
0
 public MyTableViewSource(OptionsViewController controller)
 {
     currentViewContorller = controller;
 }
Ejemplo n.º 3
0
 public MyPickerViewDataSource(OptionsViewController controller)
 {
     currentViewContorller = controller;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Ths is the main class the manages the interactions between the plot, dataview, mainform, and fragment ladder.
        /// </summary>
        /// <param name="mainForm">This should be the mainform that will contain the fragment ladder, plot and the dataview.</param>
        public Manager(MainForm mainForm)
        {
            //Plot
            m_plot                 = new SLPlot(this);
            m_plot.TopLevel        = false;
            m_plot.Visible         = true;
            m_plot.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            m_plot.Text            = "Plot";

            //Data View
            m_dataView                 = new DataView(this);
            m_dataView.TopLevel        = false;
            m_dataView.Visible         = true;
            m_dataView.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

            //Fragment Ladder
            m_fragLadder                 = new Views.FragmentLadderView.FragmentLadderView(this);
            m_fragLadder.TopLevel        = false;
            m_fragLadder.Visible         = true;
            m_fragLadder.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

            //MainForm
            m_mainForm = mainForm;

            //BuilderDirector
            m_builderDirector = new BuilderDirector();


            //For loading profile settings :
            FileStream reader         = null;
            bool       createFileFlag = false;

            // check to see if data is loaded
            DataLoaded = false;

            /*********************This is to read the UserProfile for spectrumLook**********************/
            try
            {
                reader = new FileStream(System.IO.Directory.GetCurrentDirectory() + "\\UserProfile.spuf", FileMode.Open, FileAccess.Read);
            }
            catch (Exception)
            {
                createFileFlag = true;
            }

            if (reader != null)
            {
                try
                {
                    BinaryFormatter binaryFormatter = new BinaryFormatter();
                    m_plot.m_options                   = new PlotOptions((PlotOptions)binaryFormatter.Deserialize(reader));
                    m_mainForm.m_currentOptions        = new MainFormOptions((MainFormOptions)binaryFormatter.Deserialize(reader));
                    m_fragLadder.fragmentLadderOptions = new Views.Options.FragmentLadderOptions((Views.Options.FragmentLadderOptions)binaryFormatter.Deserialize(reader));
                }
                catch { }
                finally
                {
                    reader.Close();
                }
            }
            /***************************************************************/
            //This is used to read and write the the .spuf
            m_workFileWriter = new LadderInstanceDictionaryXmlSerializer();

            //Options
            m_options = new OptionsViewController(m_plot.m_options, m_mainForm.m_currentOptions, m_fragLadder.fragmentLadderOptions, System.IO.Directory.GetCurrentDirectory() + "\\UserProfile.spuf", createFileFlag, m_fragLadder);
            m_mainForm.m_currentOptions.toleranceValue = 0.7;

            //attach all of the observers to the subjects
            IObserver tempObserver = m_plot as IObserver;

            m_plot.m_options.Attach(ref tempObserver);

            tempObserver = m_mainForm as IObserver;
            m_mainForm.m_currentOptions.Attach(ref tempObserver);

            tempObserver = m_options as IObserver;
            m_mainForm.m_currentOptions.Attach(ref tempObserver);
            m_plot.m_options.Attach(ref tempObserver);//This is because the plot window depends on the mainFormOptions.

            tempObserver = m_fragLadder as IObserver;
            // Add pre-defined symbols to modifications list
            m_fragLadder.fragmentLadderOptions.Attach(ref tempObserver);
            if (m_fragLadder.fragmentLadderOptions.modificationList.Count == 0)
            {
                m_fragLadder.fragmentLadderOptions.modificationList.Add('*', 79.9663326);
                m_fragLadder.fragmentLadderOptions.modificationList.Add('+', 14.01565);
                m_fragLadder.fragmentLadderOptions.modificationList.Add('@', 15.99492);
                m_fragLadder.fragmentLadderOptions.modificationList.Add('!', 57.02146);
                m_fragLadder.fragmentLadderOptions.modificationList.Add('&', 58.00548);
                m_fragLadder.fragmentLadderOptions.modificationList.Add('#', 71.03711);
                m_fragLadder.fragmentLadderOptions.modificationList.Add('$', 227.127);
                m_fragLadder.fragmentLadderOptions.modificationList.Add('%', 236.127);
                m_fragLadder.fragmentLadderOptions.modificationList.Add('~', 442.225);
                m_fragLadder.fragmentLadderOptions.modificationList.Add('`', 450.274);
            }

            m_plot.m_options.CopyOptions(m_plot.m_options);
            m_options.Hide();
        }