private void LoadControls()
        {
            m_Container = SaveStore.LoadControls();

            for (int i = 0; i < m_Container.Timers.Count(); i++)
            {
                actionClockControl acc = new actionClockControl(m_Container.getTimer(i));
                uxFlowPanel.Controls.Add(acc);
            }
        }
Esempio n. 2
0
 public static void SaveControls(TimerContainerStore Container)
 {
     BinaryFormatter bf = new BinaryFormatter();
     FileInfo fi = new FileInfo("TimerDatastore.dat");
     if (fi.Exists == true)
     {
         fi.Delete();
     }
     FileStream fs = new FileStream("TimerDatastore.dat", FileMode.OpenOrCreate);
     bf.Serialize(fs, Container);
     fs.Close();
 }
Esempio n. 3
0
        public static TimerContainerStore LoadControls()
        {
            FileStream fs = null;
            FileInfo fi = new FileInfo("TimerDatastore.dat");
            TimerContainerStore Container;

            if (fi.Exists == true)
            {
                try
                {
                    fs = new FileStream("TimerDatastore.dat", FileMode.Open);

                    BinaryFormatter bf = new BinaryFormatter();

                    Container = (TimerContainerStore)bf.Deserialize(fs);

                    /*
                    for (int i = 0; i < Container.Timers.Count(); i++)
                    {
                        actionClockControl acc = new actionClockControl(Container.getTimer(i));
                        uxFlowPanel.Controls.Add(acc);
                    }
                    */
                }
                catch (FileNotFoundException)
                {
                    //MessageBox.Show("Couldn't find datastore, creating it now.");
                    Container = new TimerContainerStore();
                    return Container;
                }
                catch
                {
                    //MessageBox.Show("Couldn't parse file");
                    Container = new TimerContainerStore();
                    return Container;
                }
                finally
                {
                    if (fs != null)
                        fs.Close();
                }
            }
            else
            {
                Container = new TimerContainerStore();
            }
            return Container;
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Console.Write("Google username: "******"Google password: "******"";

            do
            {
                key = Console.ReadKey(true);

                // Backspace Should Not Work
                if (key.Key != ConsoleKey.Backspace)
                {
                    password += key.KeyChar;
                    Console.Write("*");
                }
                else
                {
                    Console.Write("\b");
                }
            }
            // Stops Receving Keys Once Enter is Pressed
            while (key.Key != ConsoleKey.Enter);

            Console.WriteLine();
            // END section

            Console.Write("Document Name: ");
            string docName = Console.ReadLine();

            formatSheet mySheet = new formatSheet(username, password, docName, "Sheet1");

            TimerContainerStore myContainer = new TimerContainerStore();

            foreach (DataRow row in mySheet.dt.Rows)
            {
                TimerDatastore myData = new TimerDatastore();
                myData.UpdateStart(MasterTime.GetOffset());
                int myColumn = 0;
                foreach (object column in row.ItemArray)
                {
                    if (column.ToString() != "")
                    {
                        switch (myColumn)
                        {
                        case 0:
                            myData.UpdateLength(column.ToString());
                            MasterTime.SetOffset(MasterTime.GetOffset(), column.ToString());
                            //Console.WriteLine(showDate + " " + column.ToString() + "am");
                            break;

                        case 1:
                            myData.Name = column.ToString();
                            break;

                        default:
                            break;
                        }
                        myColumn++;
                    }
                }
                myContainer.addTimer(myData);
            }

            foreach (TimerDatastore timer in myContainer.Timers)
            {
                Console.WriteLine("Start Offset: " + timer.StartOffset.ToString());
                Console.WriteLine("End Offset: " + timer.Length.ToString());
                Console.WriteLine("Label: " + timer.Name);
                Console.WriteLine("-----------");
            }

            SaveStore.SaveControls(myContainer);
        }