Пример #1
0
    public static void Main(string[] args)
    {
        toDoList missions = new toDoList();

        Console.WriteLine("Hello World");
        Console.WriteLine("Samuel Adetunji To-Do List app!\n\n");

        //Switch case based menu
        int selection = 1;

        while (selection > 0)
        {
            Console.WriteLine("0 - Exit your list app\n1 - Add an item\n2 - Remove an item\n3 - Display to-do list\n");
            Console.Write("Please make a selection - ");
            //@stackoverflow - (user) CodeCaster
            selection = int.Parse(Console.ReadLine());
            switch (selection)
            {
            case 0: Console.WriteLine("0 - Exiting\n");
                break;

            case 1: Console.Write("\nWhat is the item - ");
                string details = Console.ReadLine();
                missions.addItem(details);
                Console.WriteLine("\nDone!");
                break;

            case 2: missions.removeItem(Console.ReadLine());
                break;

            case 3: missions.Display();
                break;
            }
        }
    }
Пример #2
0
        public ActionResult Create(ListCreateViewModel list)
        {
            var listToAdd = new toDoList()
            {
                Title   = list.Title,
                Content = list.Content,
                User    = Context.Users.FirstOrDefault(x => x.UserName == User.Identity.Name)
            };

            Context.Lists.Add(listToAdd);
            Context.SaveChanges();

            return(Redirect("../List/ViewAll"));
        }
Пример #3
0
    /*
     * //Online geo-tag
     * IEnumerator put()
     * {
     *      //Code to get location
     *      Input.location.Start ();
     *      int maxWait = 20;
     *      while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) {
     *              yield return new WaitForSeconds (1);
     *              maxWait--;
     *      }
     *      lat = Input.location.lastData.latitude;
     *      lon = Input.location.lastData.longitude;
     *      gpsText.text = lat.ToString () + " " + lon.ToString ();
     *      Input.location.Stop();
     *
     *      //Code to add to list
     *      toDoList res ;
     *      res.lat = res.lat + lat.ToString() + "~" ;
     *      res.lon = res.lon + lon.ToString() + "~" ;
     *      res.val = res.val + s1 + "~" ;
     *      res.number = res.number + 1;
     *      //Store to APi
     * }
     * IEnumerator display()
     * {
     *      //Code to get location
     *      Input.location.Start ();
     *      int maxWait = 20;
     *      while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) {
     *              yield return new WaitForSeconds (1);
     *              maxWait--;
     *      }
     *      lat = Input.location.lastData.latitude;
     *      lon = Input.location.lastData.longitude;
     *      gpsText.text = lat.ToString () + " " + lon.ToString ();
     *      Input.location.Stop();
     *      FirebaseStorage storage = FirebaseStorage.DefaultInstance;
     *
     *      //Display to-do here.
     *      string ans = "Online to-Do at this location\n" ;
     *      toDoList res = null; //data from API
     *      string[] lats = res.lat.Split ('~');
     *      string[] lons = res.lon.Split ('~');
     *      string[] vals = res.val.Split ('~');
     *      int i;
     *      for (i = 0; i < res.number; i++) {
     *              float lat2 = float.Parse( lats[i] , CultureInfo.InvariantCulture.NumberFormat);
     *              float lon2 = float.Parse( lons[i] , CultureInfo.InvariantCulture.NumberFormat);
     *              float dis = Calc( lat , lon , lat2 , lon2 ) ;
     *              ans = ans + lats [i] + " " + lons [i] + " " + vals [i] + " " + dis.ToString() + "\n" ;
     *      }
     *
     *      debugText.text = ans;
     * }*/
    //Online geo-tag end


    IEnumerator save()
    {
        //Code to get location
        Input.location.Start();
        int maxWait = 20;

        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }
        lat          = Input.location.lastData.latitude;
        lon          = Input.location.lastData.longitude;
        gpsText.text = lat.ToString() + " " + lon.ToString();
        Input.location.Stop();

        //Code to add to list
        toDoList        res;
        FileStream      file;
        BinaryFormatter bf;

        if (File.Exists(Application.persistentDataPath + "/newToDoList.dat"))
        {
            bf   = new BinaryFormatter();
            file = File.Open(Application.persistentDataPath + "/newToDoList.dat", FileMode.Open);
            res  = (toDoList)bf.Deserialize(file);
            file.Close();
        }
        else
        {
            bf         = new BinaryFormatter();
            file       = File.Create(Application.persistentDataPath + "/newToDoList.dat");
            res        = new toDoList();
            res.number = 0;
            res.lat    = "";
            res.lon    = "";
            res.val    = "";
            file.Close();
        }
        bf         = new BinaryFormatter();
        file       = File.Create(Application.persistentDataPath + "/newToDoList.dat");
        res.lat    = res.lat + lat.ToString() + "~";
        res.lon    = res.lon + lon.ToString() + "~";
        res.val    = res.val + s1 + "~";
        res.number = res.number + 1;
        bf.Serialize(file, res);
        file.Close();
    }
Пример #4
0
    IEnumerator list()
    {
        //Code to get location
        Input.location.Start();
        int maxWait = 20;

        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }
        lat          = Input.location.lastData.latitude;
        lon          = Input.location.lastData.longitude;
        gpsText.text = lat.ToString() + " " + lon.ToString();
        Input.location.Stop();

        //Display to-do here.
        string ans     = "Your personal notes at this location\n";
        string toSpeak = "Here are some of your personal notes at this location\n";

        if (File.Exists(Application.persistentDataPath + "/newToDoList.dat"))
        {
            FileStream      file = File.Open(Application.persistentDataPath + "/newToDoList.dat", FileMode.Open);
            BinaryFormatter bf   = new BinaryFormatter();
            toDoList        res  = (toDoList)bf.Deserialize(file);
            file.Close();
            string[] lats = res.lat.Split('~');
            string[] lons = res.lon.Split('~');
            string[] vals = res.val.Split('~');
            int      i, j = 1;
            for (i = 0; i < res.number; i++)
            {
                if (j <= 3)
                {
                    toSpeak = toSpeak + "Number " + j.ToString() + " " + vals [i] + "\n";
                    j++;
                }
                float lat2 = float.Parse(lats[i], CultureInfo.InvariantCulture.NumberFormat);
                float lon2 = float.Parse(lons[i], CultureInfo.InvariantCulture.NumberFormat);
                float dis  = Calc(lat, lon, lat2, lon2);
                ans = ans + lats [i] + " " + lons [i] + " " + vals [i] + " " + dis.ToString() + "\n";
            }
        }
        debugText.text = ans;
        tts.convert(toSpeak);
    }