예제 #1
0
파일: SR1.cs 프로젝트: whisp91/TME285
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "XML files (*.xml)|*.xml";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                recognizer = (IsolatedWordRecognizer)ObjectXmlSerializer.ObtainSerializedObject(openFileDialog.FileName, typeof(IsolatedWordRecognizer));
                recognizer.AvailableSoundsChanged += new EventHandler(HandleAvailableSoundsChanged);
                ShowParameters();
                ToggleParametersEditable(false);
                speechRecognizerEditingToolStrip.Visible = true;
                saveToolStripMenuItem.Enabled            = true;
                featurePlotPanel.Clear();
                HandleAvailableSoundsChanged(this, EventArgs.Empty); // A bit ugly, but OK...

                clones.Clear();
                //NUMBER OF INDIVIDUALS
                for (int i = 0; i < 100; i++)
                {
                    IsolatedWordRecognizer clone = (IsolatedWordRecognizer)ObjectXmlSerializer.ObtainSerializedObject(openFileDialog.FileName, typeof(IsolatedWordRecognizer));
                    clones.Add(clone);
                }
            }
        }
예제 #2
0
        private void generateAgentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // 20180112:
            this.Width    = Screen.GetBounds(this).Width / 2;
            this.Location = new Point((Screen.GetBounds(this).Width - this.Width) / 2, 0);
            generateAgentToolStripMenuItem.Enabled = false;

            // Generate the agent instance, and set the search paths to the constituent programs:
            agent = new Agent();
            agent.LongTermMemoryRelativePath = DEFAULT_LONGTERM_MEMORY_RELATIVE_PATH;
            agent.ClientProcessRelativePathList.Add("..\\..\\..\\FaceApplication\\bin\\Debug\\FaceApplication.exe");
            agent.ClientProcessRelativePathList.Add("..\\..\\..\\ListenerApplication\\bin\\Debug\\ListenerApplication.exe");
            agent.ClientProcessRelativePathList.Add("..\\..\\..\\SpeechApplication\\bin\\Debug\\SpeechApplication.exe");
            agent.ClientProcessRelativePathList.Add("..\\..\\..\\InternetDataAcquisitionApplication\\bin\\Debug\\InternetDataAcquisitionApplication.exe");
            agent.ClientProcessRelativePathList.Add("..\\..\\..\\VisionApplication\\bin\\Debug\\VisionApplication.exe");
            agent.Server.Progress += new EventHandler <CommunicationProgressEventArgs>(HandleAgentServerProgress);
            agent.Server.Error    += new EventHandler <CommunicationErrorEventArgs>(HandleAgentServerError);

            // Generate the agent's dialogues
            GenerateWakeUpDialogue();
            GenerateTimeDialogue();
            GenerateAttentionDialogue();
            // GenerateNameDialogue();
            GenerateWhoIsDialogue();
            GenerateWhatIsDialogue();
            GenerateIntegerArithmeticDialogue();
            GenerateGreetingDialogue();

            //NEW
            GenerateTravelDialogue();
            GenerateTravelInterestDialogue();
            GenerateShortcutDialogue();

            ShowDialogueList();
            importMemoryItemsButton.Enabled  = true;
            saveLongTermMemoryButton.Enabled = true;

            // Prepare for starting the agent: Load the long-term memory already here, so that it can be viewed and edited before starting the agent
            string longTermMemoryFilePath = Path.GetDirectoryName(Application.ExecutablePath) + "\\" + agent.LongTermMemoryRelativePath;

            if (!File.Exists(longTermMemoryFilePath))
            {
                MessageBox.Show("No long-term memory found");
                agent.LongTermMemory = new Memory();
                generateAgentToolStripMenuItem.Enabled = true;
            }
            else
            {
                agent.LongTermMemory = (Memory)ObjectXmlSerializer.ObtainSerializedObject(longTermMemoryFilePath, typeof(Memory));
                longTermMemoryViewer.SetMemory(agent.LongTermMemory);
            }
            startButton.Enabled = true;
        }
예제 #3
0
 private void loadObjectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog openFileDialog = new OpenFileDialog())
     {
         openFileDialog.Filter = ".XML files (*.xml)|*.xml";
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             serializationTestObject = (SerializationTestClass)ObjectXmlSerializer.
                                       ObtainSerializedObject(openFileDialog.FileName, typeof(SerializationTestClass));
             ShowTestObject();
         }
     }
 }
예제 #4
0
 private void LoadSynthesizer(string path)
 {
     try
     {
         _synthesizer = (SpeechSynthesizer)ObjectXmlSerializer.ObtainSerializedObject(path, typeof(SpeechSynthesizer));
     }
     catch (Exception)
     {
         _synthesizer = null;
         MessageBox.Show("Failed to load speech synthesizer: " + SynthPath, "Failed to load VSS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         speechStatusBox.Text = "Speech failed to load.";
     }
 }
예제 #5
0
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog.Filter           = "XML Files (*.xml)|*.xml";
            openFileDialog.InitialDirectory = Path.GetFullPath(defaultPath + "\\Roads");

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                roadFileName = Path.GetFileNameWithoutExtension(openFileDialog.FileName);
                metricMap    = (MetricMap)ObjectXmlSerializer.ObtainSerializedObject(openFileDialog.FileName, typeof(MetricMap));
                metricMap.GenerateTrajectories(INFORMATION_COMPRESSION, METRIC_STEP);
                GenerateMetricPath();
            }
            //batchPath += "\\BatchRunResult" + "_" + roadFileName + ".txt";
        }
예제 #6
0
 //load agent object from file with serializer
 private void LoadAccountMenuItem_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog openFileDialog = new OpenFileDialog())
     {
         openFileDialog.Filter = "XML files (*.xml)|*.xml";
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             agent = (Agent)ObjectXmlSerializer.ObtainSerializedObject(openFileDialog.FileName, typeof(Agent));
             agent.Initialize();
             agent.Server.Name      = "Agent";
             agent.Server.Progress += new EventHandler <CommunicationProgressEventArgs>(HandleAgentServerProgress);
             FinalizeSetup();
         }
     }
 }
예제 #7
0
파일: SS1.cs 프로젝트: whisp91/TME285
 private void LoadSynthesizer(string path)
 {
     try
     {
         _synthesizer = (SpeechSynthesizer)ObjectXmlSerializer.ObtainSerializedObject(path, typeof(SpeechSynthesizer));
         sentenceBox.Items.Clear();
         wordBox.Items.Clear();
         LoadSynthesizer(_synthesizer);
         speakSentenceButton.Enabled = true;
         speakWordButton.Enabled     = true;
     }
     catch (Exception)
     {
         speakSentenceButton.Enabled = false;
         speakWordButton.Enabled     = false;
     }
 }
예제 #8
0
 private void loadToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog openFileDialog = new OpenFileDialog())
     {
         openFileDialog.Filter = "XML files (*.xml)|*.xml";
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             Face face = (Face)ObjectXmlSerializer.ObtainSerializedObject(openFileDialog.FileName, typeof(Face));
             face.Generate(new List <double> {
                 face.NumberOfLongitudePoints
             });
             face.Visible = true; // This property is not serialized ...
             faceEditor.SetFace(face);
             faceEditor.Initialize();
         }
     }
 }
예제 #9
0
        private void LoadDataTest(object sender, EventArgs e)
        {
            string             trainingDataXMLPath = EigenfaceProcessorParameters.RELATIVE_PATH_TRAINING_DATA_XML;
            EigenfaceProcessor tmpEFP = (EigenfaceProcessor)ObjectXmlSerializer.ObtainSerializedObject(trainingDataXMLPath, typeof(EigenfaceProcessor), new List <Type>()
            {
                typeof(SangersAlgorithm)
            });

            eigenfaceProcessor.SangersAlgorithmObject.EigenfaceVectors = tmpEFP.SangersAlgorithmObject.EigenfaceVectors;
            eigenfaceProcessor.NbrEigenfaces                = tmpEFP.NbrEigenfaces;
            eigenfaceProcessor.ReshapeImageSize             = tmpEFP.ReshapeImageSize;
            eigenfaceProcessor.NbrDataBasePersons           = tmpEFP.NbrDataBasePersons;
            eigenfaceProcessor.NbrDataBasePicturesPerPerson = tmpEFP.NbrDataBasePicturesPerPerson;
            nbrOfEigenfacesTextBox.Text = eigenfaceProcessor.NbrEigenfaces.ToString();

            richTextBox1.Text += "Eigenface vectors loaded\n";
        }
예제 #10
0
        private void loadSpeechSynthesizerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter = "XML files (*.xml)|*xml";
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    speechSynthesizer = (FormantSpeechSynthesizer)ObjectXmlSerializer.ObtainSerializedObject(openFileDialog.FileName, typeof(FormantSpeechSynthesizer));

                    foreach (FormantSpecification fs in speechSynthesizer.SpecificationList)
                    {
                        fs.FormantSettingsList.Last().TransitionStart = 1;
                    }

                    ShowSpeechSynthesizer();
                    saveSpeechSynthesizerToolStripMenuItem.Enabled = true;
                    speakSentenceButton.Enabled = true;
                }
            }
        }
예제 #11
0
        public Head()
        {
            Object3DList = new List <Object3D>();

            string path = Path.GetDirectoryName(Application.ExecutablePath) + "..\\..\\..\\head.xml";
            Face   face = (Face)ObjectXmlSerializer.ObtainSerializedObject(path, typeof(Face));

            face.Name = "face";
            face.Generate(new List <double> {
                512
            });
            face.ShowWireFrame = false;
            face.ShowSurfaces  = true;
            face.Visible       = true;
            face.SpecularColor = System.Drawing.Color.Bisque;
            face.Object3DList  = new List <Object3D>();

            _leftEye  = new Eye("leftEye", 1);
            _rightEye = new Eye("rightEye", -1);

            Object3DList.Add(face);
            Object3DList.Add(_leftEye);
            Object3DList.Add(_rightEye);
        }
        private void Initialize()
        {
            randomNumberGenerator = new Random();
            string faceFileName = Path.GetDirectoryName(Application.ExecutablePath) + DEFAULT_RELATIVE_FACE_FILE_NAME;

            if (File.Exists(faceFileName))
            {
                face      = (Face)ObjectXmlSerializer.ObtainSerializedObject(faceFileName, typeof(Face));
                face.Name = "Face";
                face.Generate(new List <double> {
                    128
                });
                face.Visible       = true;
                face.SpecularColor = Color.OrangeRed;
                face.Shininess     = 50;

                // A lot of ugly hard-coding here, but OK - just for demonstration:
                face.Object3DList = new List <Object3D>();

                Sphere3D leftEyeBulb = new Sphere3D();
                leftEyeBulb.Generate(new List <double>()
                {
                    0.07, 64, 64
                });
                leftEyeBulb.AmbientColor  = Color.White;
                leftEyeBulb.DiffuseColor  = Color.White;
                leftEyeBulb.SpecularColor = Color.White;
                leftEyeBulb.Shininess     = 50;
                leftEyeBulb.ShowSurfaces  = true;
                // leftEyeBulb.Move(-0.1375, -0.403, 1.145);
                leftEyeBulb.ShadingModel = ShadingModel.Smooth;
                leftEyeBulb.UseLight     = true;
                leftEyeBulb.Name         = "LeftEye";
                leftEyeBulb.Object3DList = new List <Object3D>();

                SphereSegment3D leftEyeIris = new SphereSegment3D();
                leftEyeIris.Generate(new List <double>()
                {
                    0.07, 32, 32, Math.PI / 3
                });
                leftEyeIris.AmbientColor  = Color.Green;
                leftEyeIris.DiffuseColor  = Color.Green;
                leftEyeIris.SpecularColor = Color.White;
                leftEyeIris.Shininess     = 50;
                leftEyeIris.ShowSurfaces  = true;
                //   leftEyeIris.Move(-0.1375, -0.407, 0.145);
                leftEyeIris.Move(0, -0.005, 0);
                leftEyeIris.RotateX(90);
                SphereSegment3D leftEyePupil = new SphereSegment3D();
                leftEyePupil.Generate(new List <double>()
                {
                    0.07, 16, 32, Math.PI / 2 - 0.2
                });
                leftEyePupil.AmbientColor  = Color.Black;
                leftEyePupil.DiffuseColor  = Color.Black;
                leftEyePupil.SpecularColor = Color.White;
                leftEyePupil.Shininess     = 50;
                leftEyePupil.ShowSurfaces  = true;
                leftEyePupil.Move(0, -0.01, 0);
                leftEyePupil.RotateX(90); // , 0, 0);
                                          //   leftEyePupil.RotateX(Math.PI / 2);
                                          //  leftEyePupil.Translate(-0.1375, -0.4758, 0.0725);
                leftEyePupil.ShadingModel = ShadingModel.Smooth;
                leftEyePupil.UseLight     = true;
                SphereSegment3D leftEyeLid = new SphereSegment3D();
                leftEyeLid.Name = "LeftEyeLid";
                leftEyeLid.Generate(new List <double>()
                {
                    0.07, 32, 32, 0.0
                });
                leftEyeLid.AmbientColor  = Color.FromArgb(255, 205, 148); // Typical skin color approximation
                leftEyeLid.DiffuseColor  = Color.FromArgb(255, 205, 148); // Typical skin color approximation
                leftEyeLid.SpecularColor = Color.White;
                leftEyeLid.Shininess     = 50;
                leftEyeLid.ShowSurfaces  = true;
                leftEyeLid.RotateX(-36);
                leftEyeLid.Move(0, -0.015, 0);
                leftEyeBulb.Object3DList.Add(leftEyeIris);
                leftEyeBulb.Object3DList.Add(leftEyePupil);
                leftEyeBulb.Object3DList.Add(leftEyeLid);
                face.Object3DList.Add(leftEyeBulb);

                Sphere3D rightEyeBulb = new Sphere3D();
                rightEyeBulb.Generate(new List <double>()
                {
                    0.07, 64, 64
                });
                rightEyeBulb.AmbientColor  = Color.White;
                rightEyeBulb.DiffuseColor  = Color.White;
                rightEyeBulb.SpecularColor = Color.White;
                rightEyeBulb.Shininess     = 50;
                rightEyeBulb.ShowSurfaces  = true;
                //  rightEyeBulb.Move(0.1375, -0.403, 0.145);
                rightEyeBulb.ShadingModel = ShadingModel.Smooth;
                rightEyeBulb.UseLight     = true;
                rightEyeBulb.Name         = "RightEye";
                rightEyeBulb.Object3DList = new List <Object3D>();
                face.Object3DList.Add(rightEyeBulb);
                SphereSegment3D rightEyeIris = new SphereSegment3D();
                rightEyeIris.Generate(new List <double>()
                {
                    0.07, 32, 32, Math.PI / 3
                });
                rightEyeIris.AmbientColor  = Color.Green;
                rightEyeIris.DiffuseColor  = Color.Green;
                rightEyeIris.SpecularColor = Color.White;
                rightEyeIris.Shininess     = 50;
                rightEyeIris.ShowSurfaces  = true;
                rightEyeIris.RotateX(90); //  , 0, 0);
                rightEyeIris.Move(0, -0.005, 0);
                //   rightEyeIris.RotateX(Math.PI / 2);
                //   rightEyeIris.Translate(0.1375, -0.4715, 0.075);
                rightEyeIris.ShadingModel = ShadingModel.Smooth;
                rightEyeIris.UseLight     = true;
                SphereSegment3D rightEyePupil = new SphereSegment3D();
                rightEyePupil.Generate(new List <double>()
                {
                    0.07, 16, 32, Math.PI / 2 - 0.2
                });
                rightEyePupil.AmbientColor  = Color.Black;
                rightEyePupil.DiffuseColor  = Color.Black;
                rightEyePupil.SpecularColor = Color.White;
                rightEyePupil.Shininess     = 50;
                rightEyePupil.ShowSurfaces  = true;
                rightEyePupil.RotateX(90); //, 0, 0);
                rightEyePupil.Move(0, -0.01, 0);
                //  rightEyePupil.RotateX(Math.PI / 2);
                //  rightEyePupil.Translate(0.1375, -0.4758, 0.0725);
                rightEyePupil.ShadingModel = ShadingModel.Smooth;
                rightEyePupil.UseLight     = true;
                SphereSegment3D rightEyeLid = new SphereSegment3D();
                rightEyeLid.Name = "RightEyeLid";
                rightEyeLid.Generate(new List <double>()
                {
                    0.07, 32, 32, 0.0
                });
                rightEyeLid.AmbientColor  = Color.FromArgb(255, 205, 148); // Typical skin color approximation
                rightEyeLid.DiffuseColor  = Color.FromArgb(255, 205, 148); // Typical skin color approximation
                rightEyeLid.SpecularColor = Color.White;
                rightEyeLid.Shininess     = 50;
                rightEyeLid.ShowSurfaces  = true;
                rightEyeLid.RotateX(-36); // , 0, 0);
                rightEyeLid.Move(0, -0.015, 0);
                rightEyeBulb.Object3DList.Add(rightEyeIris);
                rightEyeBulb.Object3DList.Add(rightEyePupil);
                rightEyeBulb.Object3DList.Add(rightEyeLid);

                TorusSector3D leftEyebrow = new TorusSector3D();
                leftEyebrow.Name = "LeftEyebrow";
                leftEyebrow.Generate(new List <double> {
                    0.15, 0.01, 30, 30, 3 * Math.PI / 2 - 0.60, 3 * Math.PI / 2 + 0.40
                });
                leftEyebrow.AmbientColor  = Color.Black;
                leftEyebrow.DiffuseColor  = Color.Black;
                leftEyebrow.SpecularColor = Color.White;
                leftEyebrow.Shininess     = 50;
                leftEyebrow.ShowSurfaces  = true;
                leftEyebrow.RotateZ(-11);
                TorusSector3D rightEyebrow = new TorusSector3D();
                rightEyebrow.Name = "RightEyebrow";
                rightEyebrow.Generate(new List <double> {
                    0.15, 0.01, 30, 30, 3 * Math.PI / 2 - 0.60, 3 * Math.PI / 2 + 0.40
                });
                rightEyebrow.AmbientColor  = Color.Black;
                rightEyebrow.DiffuseColor  = Color.Black;
                rightEyebrow.SpecularColor = Color.White;
                rightEyebrow.Shininess     = 50;
                rightEyebrow.ShowSurfaces  = true;
                rightEyebrow.RotateZ(11);
                face.Object3DList.Add(leftEyebrow);
                face.Object3DList.Add(rightEyebrow);

                face.Move(0, 0, -0.5);
                leftEyeBulb.Move(-0.1375, -0.403, 0.645);
                rightEyeBulb.Move(0.1375, -0.403, 0.645);
                leftEyebrow.Move(-0.11, -0.325, 0.73);
                rightEyebrow.Move(0.11, -0.325, 0.73);

                // Close eyes to start with:
                leftEyeLid.RotateX(120);
                rightEyeLid.RotateX(120);
                leftEyebrow.Move(0, -0.005, -0.02);
                rightEyebrow.Move(0, -0.005, -0.02);
                eyesClosed = true;

                Scene3D scene = new Scene3D();
                Light   light = new Light();
                light.IsOn     = true;
                light.Position = new List <float>()
                {
                    0.0f, -3.0f, 1f, 1.0f
                };
                scene.LightList.Add(light);
                scene.AddObject(face);
                viewer3D.Scene           = scene;
                viewer3D.ShowWorldAxes   = false; // true;
                viewer3D.CameraDistance  = 0.8;
                viewer3D.CameraLatitude  = Math.PI / 24;
                viewer3D.CameraLongitude = -Math.PI / 2;
                //  viewer3D.Invalidate();
                viewer3D.StartAnimation();
            }

            normalThreadRunning = true;
            normalThread        = new Thread(new ThreadStart(NormalLoop));
            normalThread.Start();
        }
예제 #13
0
        static void Main()
        {
            //TODO: copy to InetDataAcq
            //1. Search request erstellen => url
            //2. Get Json from Url (http://www.omdbapi.com) http://www.omdbapi.com/?t=scream&apikey=c983ca13
            //3. Parse Json
            //4. Create Movies

            //var antwort = GET("http://www.omdbapi.com/?t=scream&apikey=c983ca13");
            //Debug.WriteLine(antwort);

            //string GET(string url)
            //{
            //    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            //    try
            //    {
            //        WebResponse response = request.GetResponse();
            //        using (Stream responseStream = response.GetResponseStream())
            //        {
            //            StreamReader reader = new StreamReader(responseStream, System.Text.Encoding.UTF8);
            //            return reader.ReadToEnd();
            //        }
            //    }
            //    catch (WebException ex)
            //    {
            //        WebResponse errorResponse = ex.Response;
            //        using (Stream responseStream = errorResponse.GetResponseStream())
            //        {
            //            StreamReader reader = new StreamReader(responseStream, System.Text.Encoding.GetEncoding("utf-8"));
            //            String errorText = reader.ReadToEnd();
            //            // log errorText
            //        }
            //        throw;
            //    }
            //}

            var _ultraManager = UltraManager.Instance;

            /*
             * string url = "http://www.omdbapi.com/?t=scream&apikey=c983ca13";
             * using (WebClient wc = new WebClient())
             * {
             *  var json = wc.DownloadString(url);
             *  JavaScriptSerializer oJS = new JavaScriptSerializer();
             *  ImdbEntity obj = new ImdbEntity();
             *  obj = oJS.Deserialize<ImdbEntity>(json);
             *  if (obj.Response == "True")
             *  {
             *      string movieTitle = obj.Title;
             *      double imdbRating = Convert.ToDouble(obj.imdbRating);
             *      int year = Convert.ToInt16(obj.Year);
             *
             *      Movie newMovie = new Movie(movieTitle, year, imdbRating);
             *      Debug.WriteLine(newMovie.Title);
             *      Debug.WriteLine(newMovie.Year);
             *      Debug.WriteLine(newMovie.ImdbRating);
             *      _ultraManager.MovieList.Add(newMovie);
             *
             *  }
             *  else
             *  {
             *      Debug.WriteLine("not found");
             *  }
             * }
             */
            /*string test = "Imdb|" + " " + "scream";
             * List<string> requestSplit = test.Split(new char[] { AgentConstants.INTERNET_SEARCH_REQUEST_SEPARATOR_CHARACTER },
             *  StringSplitOptions.RemoveEmptyEntries).ToList();
             * if (requestSplit[0].ToUpper().TrimEnd(new char[] { ' ' }) == "IMDB")
             * {
             *  string txtMovieName = requestSplit[1].Replace(" ", "");
             *  Debug.WriteLine(txtMovieName.Trim());
             * }*/


            Movie movie1 = new Movie("Pulp fiction", 1991, 8.9, "Drama");
            Movie movie2 = new Movie("The big lebowski", 1991, 8.9, "Drama");
            Movie movie3 = new Movie("Rum diary", 1991, 8.9, "Drama");
            Movie movie4 = new Movie("The room", 1991, 8.9, "Drama");
            Movie movie5 = new Movie("Chinatown", 1991, 8.9, "Drama");
            Movie movie6 = new Movie("Get out", 1991, 8.9, "Drama");
            Movie movie7 = new Movie("Jaws", 1991, 8.9, "Drama");

            _ultraManager.MovieList.Add(movie1);
            _ultraManager.MovieList.Add(movie2);
            _ultraManager.MovieList.Add(movie3);
            _ultraManager.MovieList.Add(movie4);
            _ultraManager.MovieList.Add(movie5);
            _ultraManager.MovieList.Add(movie6);
            _ultraManager.MovieList.Add(movie7);


            //jack
            Rating rating11 = new Rating("Pulp fiction", "jack", 2.0);

            _ultraManager.RatingList.Add(rating11);
            Rating rating12 = new Rating("The big lebowski", "jack", 1.0);

            _ultraManager.RatingList.Add(rating12);
            Rating rating13 = new Rating("The room", "jack", 5.0);

            _ultraManager.RatingList.Add(rating13);
            Rating rating14 = new Rating("Chinatown", "jack", 8.0);

            _ultraManager.RatingList.Add(rating14);
            Rating rating15 = new Rating("Get out", "jack", 10.0);

            _ultraManager.RatingList.Add(rating15);
            Rating rating16 = new Rating("Jaws", "jack", 9.0);

            _ultraManager.RatingList.Add(rating16);

            //gösta
            Rating rating21 = new Rating("Pulp fiction", "goesta", 10.0);

            _ultraManager.RatingList.Add(rating21);
            Rating rating22 = new Rating("The big lebowski", "goesta", 9.0);

            _ultraManager.RatingList.Add(rating22);
            Rating rating23 = new Rating("The room", "goesta", 7.0);

            _ultraManager.RatingList.Add(rating23);
            Rating rating24 = new Rating("Chinatown", "goesta", 3.0);

            _ultraManager.RatingList.Add(rating24);
            Rating rating25 = new Rating("Get out", "goesta", 8.0);

            _ultraManager.RatingList.Add(rating25);
            Rating rating26 = new Rating("Jaws", "goesta", 1.0);

            _ultraManager.RatingList.Add(rating26);
            Rating rating27 = new Rating("Rum diary", "goesta", 6.0);

            _ultraManager.RatingList.Add(rating27);

            //fredrik
            Rating rating31 = new Rating("Pulp fiction", "fredrik", 10.0);

            _ultraManager.RatingList.Add(rating31);
            Rating rating32 = new Rating("The big lebowski", "fredrik", 9.0);

            _ultraManager.RatingList.Add(rating32);
            Rating rating34 = new Rating("Chinatown", "fredrik", 2.0);

            _ultraManager.RatingList.Add(rating34);
            Rating rating37 = new Rating("Rum diary", "fredrik", 1.0);

            _ultraManager.RatingList.Add(rating37);

            //simon
            Rating rating41 = new Rating("Pulp fiction", "simon", 3.0);

            _ultraManager.RatingList.Add(rating41);
            Rating rating42 = new Rating("The big lebowski", "simon", 2.0);

            _ultraManager.RatingList.Add(rating42);
            Rating rating43 = new Rating("The room", "simon", 5.0);

            _ultraManager.RatingList.Add(rating43);
            Rating rating44 = new Rating("Chinatown", "simon", 9.0);

            _ultraManager.RatingList.Add(rating44);
            Rating rating45 = new Rating("Get out", "simon", 8.0);

            _ultraManager.RatingList.Add(rating45);
            Rating rating47 = new Rating("Rum diary", "simon", 9.0);

            _ultraManager.RatingList.Add(rating47);

            //eliane
            Rating rating51 = new Rating("Pulp fiction", "eliane", 3.0);

            _ultraManager.RatingList.Add(rating51);
            Rating rating54 = new Rating("Chinatown", "eliane", 9.0);

            _ultraManager.RatingList.Add(rating54);
            Rating rating56 = new Rating("Jaws", "eliane", 2.0);

            _ultraManager.RatingList.Add(rating56);
            Rating rating57 = new Rating("Rum diary", "eliane", 6.0);

            _ultraManager.RatingList.Add(rating57);

            //samuel
            Rating rating61 = new Rating("Pulp fiction", "samuel", 4.0);

            _ultraManager.RatingList.Add(rating61);
            Rating rating62 = new Rating("The big lebowski", "samuel", 3.0);

            _ultraManager.RatingList.Add(rating62);
            Rating rating63 = new Rating("The room", "samuel", 6.0);

            _ultraManager.RatingList.Add(rating63);
            Rating rating64 = new Rating("Chinatown", "samuel", 9.0);

            _ultraManager.RatingList.Add(rating64);
            Rating rating66 = new Rating("Jaws", "samuel", 8.0);

            _ultraManager.RatingList.Add(rating66);
            Rating rating67 = new Rating("Rum diary", "samuel", 8.0);

            _ultraManager.RatingList.Add(rating67);


            User user1 = new User("simon", false, "");

            _ultraManager.UserList.Add(user1);
            User user2 = new User("goesta", false, "");

            _ultraManager.UserList.Add(user2);
            User user3 = new User("jack", false, "");

            _ultraManager.UserList.Add(user3);
            User user4 = new User("samuel", false, "");

            _ultraManager.UserList.Add(user4);
            User user5 = new User("eliane", false, "");

            _ultraManager.UserList.Add(user5);
            User user6 = new User("fredrik", false, "");

            _ultraManager.UserList.Add(user6);


            //var userList = new List<User>
            //{
            //    new User("newUser2", false, ""),
            //    new User("newUser3", false, ""),
            //    new User("newUser4", false, "")
            //};

            //foreach (var user in userList)
            //{
            //    Debug.WriteLine(user.Name);
            //}


            //-----------------------------------------------------------------------------------------------------------------
            //SERIALIZATION
            //https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/data-contract-known-types
            //TODO: how to use without changing library?
            //ObjectXmlSerializer sdata = new ObjectXmlSerializer();

            //User version
            //List<Type> typeList = new List<Type>();
            //typeList.Add(Type.GetType("Dicitonary"));
            //ObjectXmlSerializer.SerializeObject("test", user1, typeList);
            //ObjectXmlSerializer.ObtainSerializedObject("test", typeof(User), typeList);
            //User user10 = (User)ObjectXmlSerializer.ObtainSerializedObject("test", typeof(User), typeList);

            //Singleton version
            List <Type> typeList = new List <Type>();

            typeList.Add(Type.GetType("UltraManager"));
            ObjectXmlSerializer.SerializeObject("testSingleton", _ultraManager, typeList);
            ObjectXmlSerializer.ObtainSerializedObject("testSingleton", typeof(UltraManager), typeList);
            UltraManager _ultraManagerNew = (UltraManager)ObjectXmlSerializer.ObtainSerializedObject("testSingleton", typeof(UltraManager), typeList);

            foreach (var movie in _ultraManagerNew.MovieList)
            {
                Debug.WriteLine(movie.Title);
            }

            //user10.Ratings.Add(movie3, 3);

            //foreach (var user10Rating in user10.Ratings)
            //{
            //    Debug.Write(user10Rating.Value);
            //}
            //-----------------------------------------------------------------------------------------------------------------


            //foreach (var rating in user1.Ratings)
            //{
            //    Debug.WriteLine($"{rating.Key.Title} - {rating.Value}");
            //}


            //var movies = new List<Movie>
            //{
            //    new Movie(),
            //    new Movie(),
            //    new Movie()
            //};

            //Linq Queries
            //users.First(user => user.Name == "newUser2").Ratings.Add(movies.First(),15);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new AgentMainForm());
        }