private void MainWindowViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     switch (e.PropertyName)
     {
     case nameof(FinalContent):
         string pageName = FinalContent.GetPageName();
         TelemetryExtension.Current?.TrackPageVisited(pageName);
         break;
     }
 }
Beispiel #2
0
        private void metroTile1_Click(object sender, EventArgs e)
        {
            flist.Clear();
            string  senti  = "";
            string  ByAllx = RemoveSpecialCharacter(textBox4.Text);
            Process q      = new Process();

            q.StartInfo.FileName  = @"C:\\Program Files (x86)\\Invoke Engine\\CSAT\\exe\\test.exe";
            q.StartInfo.Arguments = "\"" + ByAllx + "\"";
            q.StartInfo.RedirectStandardOutput = true;
            q.StartInfo.UseShellExecute        = false;
            q.StartInfo.RedirectStandardOutput = true;
            q.StartInfo.CreateNoWindow         = true;

            q.Start();

            using (StreamReader reader = q.StandardOutput)
            {
                string sentiment   = reader.ReadToEnd();
                string replacement = Regex.Replace(sentiment, @"\t|\n|\r", "");
                double sent        = double.Parse(replacement);
                //     MessageBox.Show(sent.ToString());
                if (sent < -0.3)
                {
                    senti = "n";
                }
                if (sent > 0.3)
                {
                    senti = "p";
                }
                if (sent >= -0.3 && sent <= 0.3)
                {
                    senti = "o";
                }
            }



            Citing = textBox1.Text.Replace("-", "");
            Cited  = textBox2.Text.Replace("-", "");

            string value = send(textBox4.Text);

            Char delimiter = ' ';

            String[] substrings    = value.Split(delimiter);
            String   AllowedChars2 = @"^[a-zA-Z]{3,}";



            foreach (var substring in substrings)
            {
                if (Regex.IsMatch(substring, AllowedChars2))
                {
                    ContentVerb verbdata     = new ContentVerb();
                    int         indexOfSteam = substring.IndexOf("/");
                    if (indexOfSteam >= 0)
                    {
                        string subs = substring.Remove(indexOfSteam);
                        verbdata.content = subs;
                    }

                    verbdata.repition = repitions;
                    showlist.Add(verbdata);
                }
            }
            int repeat = showlist.Count;

            for (int pass = 0; pass < showlist.Count; pass++)
            {
                for (int i = pass + 1; i < showlist.Count; i++)
                {
                    if (showlist[pass].content == showlist[i].content)
                    {
                        showlist[i].repition = showlist[pass].repition + 1;
                        showlist.RemoveAt(pass);
                    }
                }
            }

            for (int p = 0; p < showlist.Count; p++)
            {
                FinalContent f = new FinalContent();
                f.content  = showlist[p].content;
                f.repition = showlist[p].repition;
                flist.Add(f);
            }
            var bindingList = new BindingList <FinalContent>(flist);
            var source      = new BindingSource(bindingList, null);

            dataGridView2.DataSource = source;

            for (int x = 0; x < list1.Count; x++)
            {
                for (int y = 0; y < showlist.Count; y++)
                {
                    if (showlist[y].content == list1[x])
                    {
                        showlist[y].type    = "Using_the_Work";
                        showlist[y].typeno2 = "p";
                        showlist[y].piority = 1;
                    }
                }
            }
            for (int x = 0; x < list2.Count; x++)
            {
                for (int y = 0; y < showlist.Count; y++)
                {
                    if (showlist[y].content == list2[x])
                    {
                        showlist[y].type    = "Extending_the_work";
                        showlist[y].typeno2 = "p";
                        showlist[y].piority = 2;
                    }
                }
            }
            for (int x = 0; x < list3.Count; x++)
            {
                for (int y = 0; y < showlist.Count; y++)
                {
                    if (showlist[y].content == list3[x])
                    {
                        showlist[y].type    = "Based_On";
                        showlist[y].typeno2 = "p";
                        showlist[y].piority = 3;
                    }
                }
            }
            for (int x = 0; x < list4.Count; x++)
            {
                for (int y = 0; y < showlist.Count; y++)
                {
                    if (showlist[y].content == list4[x])
                    {
                        showlist[y].type    = "Disagree_With_the_Work";
                        showlist[y].typeno2 = "n";
                        showlist[y].piority = 2;
                    }
                }
            }
            for (int x = 0; x < list5.Count; x++)
            {
                for (int y = 0; y < showlist.Count; y++)
                {
                    if (showlist[y].content == list5[x])
                    {
                        showlist[y].type    = "Comparison_and_Contrast";
                        showlist[y].typeno2 = "n";
                        showlist[y].piority = 1;
                    }
                }
            }
            for (int x = 0; x < list6.Count; x++)
            {
                for (int y = 0; y < showlist.Count; y++)
                {
                    if (showlist[y].content == list6[x])
                    {
                        showlist[y].type    = "Criticizing_the_Work";
                        showlist[y].typeno2 = "n";
                        showlist[y].piority = 3;
                    }
                }
            }
            for (int x = 0; x < list7.Count; x++)
            {
                for (int y = 0; y < showlist.Count; y++)
                {
                    if (showlist[y].content == list7[x])
                    {
                        showlist[y].type    = "Related_Work";
                        showlist[y].typeno2 = "o";
                        showlist[y].piority = 1;
                    }
                }
            }
            for (int x = 0; x < list8.Count; x++)
            {
                for (int y = 0; y < showlist.Count; y++)
                {
                    if (showlist[y].content == list8[x])
                    {
                        showlist[y].type    = "Background";
                        showlist[y].typeno2 = "o";
                        showlist[y].piority = 2;
                    }
                }
            }



            string path = @"C:\Users\lenovo\Desktop\FYP\FYP\GraphRepresentation\GraphRepresentation\bin\Debug\Example.dot";

            System.IO.File.Create(path).Dispose();
            using (TextWriter tw = new StreamWriter(path))
            {
                if (textBox3.Text == "n")
                {
                    tw.WriteLine("digraph G { " + Citing + " -> " + Cited + "[label=_" + textBox3.Text + " color=red];}");
                    tw.Close();
                }
                if (textBox3.Text == "o")
                {
                    tw.WriteLine("digraph G { " + Citing + " -> " + Cited + "[label=_" + textBox3.Text + " color=blue];}");
                    tw.Close();
                }
                if (textBox3.Text == "p")
                {
                    tw.WriteLine("digraph G { " + Citing + " -> " + Cited + "[label=_" + textBox3.Text + " color=green];}");
                    tw.Close();
                }
            }



            ///////////////////////////////////////////////////////////////////

            string path2 = @"C:\Users\lenovo\Desktop\FYP\FYP\GraphRepresentation\GraphRepresentation\bin\Debug\Example2.dot";

            System.IO.File.Create(path2).Dispose();
            using (TextWriter tw2 = new StreamWriter(path2))
            {
                if (senti == "n")
                {
                    tw2.WriteLine("digraph G { " + Citing + " -> " + Cited + "[label=_" + senti + " color=red];}");
                    tw2.Close();
                }
                if (senti == "o")
                {
                    tw2.WriteLine("digraph G { " + Citing + " -> " + Cited + "[label=_" + senti + " color=blue];}");
                    tw2.Close();
                }
                if (senti == "p")
                {
                    tw2.WriteLine("digraph G { " + Citing + " -> " + Cited + "[label=_" + senti + " color=green];}");
                    tw2.Close();
                }
            }


            ////////////////////////////////////////////////////
            string path3 = @"C:\Users\lenovo\Desktop\FYP\FYP\GraphRepresentation\GraphRepresentation\bin\Debug\Example3.dot";

            System.IO.File.Create(path3).Dispose();
            using (TextWriter tw3 = new StreamWriter(path3))
            {
                if (textBox3.Text == "n")
                {
                    tw3.WriteLine("digraph G { " + Citing + " -> " + Cited + "[label=_" + "Comparison_and_Contrast" + " color=red];}");
                    tw3.Close();
                }
                if (textBox3.Text == "o")
                {
                    tw3.WriteLine("digraph G { " + Citing + " -> " + Cited + "[label=_" + "Related_Work" + " color=blue];}");
                    tw3.Close();
                }
                if (textBox3.Text == "p")
                {
                    tw3.WriteLine("digraph G { " + Citing + " -> " + Cited + "[label=_" + "Using_the_Work" + " color=green];}");
                    tw3.Close();
                }
            }


            ///////////////////////////////////////////////////////

            Process cmd  = new Process();
            Process cmd2 = new Process();
            Process cmd3 = new Process();


            System.Diagnostics.Process.Start("run.exe");
            System.Diagnostics.Process.Start("run2.exe");
            System.Diagnostics.Process.Start("run3.exe");
            System.Threading.Thread.Sleep(2000);
            pictureBox1.ImageLocation = @"C:\Users\lenovo\Desktop\FYP\FYP\GraphRepresentation\GraphRepresentation\bin\Debug\graphname2.png";
            pictureBox2.ImageLocation = @"C:\Users\lenovo\Desktop\FYP\FYP\GraphRepresentation\GraphRepresentation\bin\Debug\graphname3.png";
            pictureBox3.ImageLocation = @"C:\Users\lenovo\Desktop\FYP\FYP\GraphRepresentation\GraphRepresentation\bin\Debug\graphname4.png";

            cmd.Close();
            cmd2.Close();
            cmd3.Close();
            showlist.Clear();
        }