示例#1
0
        private void InsertTextToListButton_Click(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection items = TextlistView.SelectedItems;
            for (int x = 0; x < items.Count; x++)
            {
                StatisticsListItem statisticsItem = new StatisticsListItem();
                statisticsItem.ItemType = 2;
                string textTopic     = items[x].Text;
                string textSubTopic  = items[x].SubItems[1].Text;
                string textShortText = items[x].SubItems[2].Text;
                string textLongText  = items[x].SubItems[3].Text;

                statisticsItem.ItemName = textTopic + textSubTopic;


                ListViewItem ii = (ListViewItem)items[x].Clone();

                //ii.SubItems;
                bool existsInStatisticsList = false;
                foreach (ListViewItem item in StatisticsListView.Items)
                {
                    if (item.Text == ii.Text &&
                        item.SubItems[1].Text == textSubTopic &&
                        item.SubItems[2].Text == textShortText)
                    {
                        existsInStatisticsList = true;
                    }
                }
                if (!existsInStatisticsList)
                {
                    MainForm mainForm      = (MainForm)this.parentForm;
                    int      numOfSessions = mainForm.numOfSessions;

                    string picName = mainForm.MainDirectory + "\\pictures\\Text.jpg";
                    Bitmap image1  = new Bitmap(picName);
                    Bitmap image   = new Bitmap(image1, new Size(32, 32));
                    StatisticsListView.LargeImageList.Images.Add(image);
                    //ListViewItem textListItem = TextlistView.Items.Add(text.topic, x);
                    image = new Bitmap(image1, new Size(16, 16));
                    StatisticsListView.SmallImageList.Images.Add(image);
                    ii.ImageIndex = StatisticsListView.SmallImageList.Images.Count - 1;
                    StatisticsListView.Items.Add(ii);        //add to view
                    StatisticsArrayList.Add(statisticsItem); //add to memory
                }
                //ListViewItem textListItem = StatisticsListView.Items.Add(InstrumentListView.Items[items[x]]);
            }
        }
示例#2
0
        private void InsertGeneralItemsToListButton_Click(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection items = GeneralStatisticItemsListView.SelectedItems;
            string picName = "";

            for (int x = 0; x < items.Count; x++)
            {
                StatisticsListItem statisticsItem = new StatisticsListItem();
                string             textTopic      = items[x].Text;
                statisticsItem.ItemName = textTopic;

                ListViewItem ii            = (ListViewItem)items[x].Clone();
                MainForm     mainForm      = (MainForm)this.parentForm;
                int          numOfSessions = mainForm.numOfSessions;

                if (ii.Text == "Arrow")
                {
                    statisticsItem.ItemType = 3;
                    picName = mainForm.MainDirectory + "\\pictures\\arrow.jpg";
                    ii.SubItems.Add("3");
                }
                if (ii.Text == "Disc")
                {
                    statisticsItem.ItemType = 4;
                    picName = mainForm.MainDirectory + "\\pictures\\disc.jpg";
                    ii.SubItems.Add("4");
                }
                if (ii.Text == "Sing")
                {
                    statisticsItem.ItemType = 5;
                    ii.SubItems.Add("5");
                    picName = mainForm.MainDirectory + "\\pictures\\sing.jpg";
                }
                if (ii.Text == "Scream")
                {
                    statisticsItem.ItemType = 6;
                    picName = mainForm.MainDirectory + "\\pictures\\scream.jpg";
                    ii.SubItems.Add("6");
                }
                if (ii.Text == "Silence")
                {
                    statisticsItem.ItemType = 7;
                    picName = mainForm.MainDirectory + "\\pictures\\silence.jpg";
                    ii.SubItems.Add("7");
                }


                bool existsInStatisticsList = false;
                foreach (ListViewItem item in StatisticsListView.Items)
                {
                    if (item.Text == ii.Text)
                    {
                        existsInStatisticsList = true;
                    }
                }
                if (!existsInStatisticsList)
                {
                    Bitmap image1 = new Bitmap(picName);
                    Bitmap image  = new Bitmap(image1, new Size(32, 32));
                    StatisticsListView.LargeImageList.Images.Add(image);
                    //ListViewItem textListItem = TextlistView.Items.Add(text.topic, x);
                    image = new Bitmap(image1, new Size(16, 16));
                    StatisticsListView.SmallImageList.Images.Add(image);
                    ii.ImageIndex = StatisticsListView.SmallImageList.Images.Count - 1;

                    StatisticsListView.Items.Add(ii);        //add to view
                    StatisticsArrayList.Add(statisticsItem); //add to memory
                }
                //ListViewItem textListItem = StatisticsListView.Items.Add(InstrumentListView.Items[items[x]]);
            }
        }
示例#3
0
        private void removeItemFromListView(int type, ListViewItem item)
        {
            string instrumentName1        = item.Text;
            string instrumentCategory1    = item.SubItems[1].Text;
            string instrumentSubCategory1 = item.SubItems[2].Text;
            string instrumentDescription1 = item.SubItems[3].Text;
            string itemName1 = instrumentCategory1 + "\\" + instrumentSubCategory1 + "\\" + instrumentName1;

            switch (type)
            {
            case 1:
                for (int x = 0; x < StatisticsListView.Items.Count; x++)
                {
                    string instrumentName        = StatisticsListView.Items[x].Text;
                    string instrumentCategory    = StatisticsListView.Items[x].SubItems[1].Text;
                    string instrumentSubCategory = StatisticsListView.Items[x].SubItems[2].Text;
                    string instrumentDescription = StatisticsListView.Items[x].SubItems[3].Text;
                    string itemName = instrumentCategory + "\\" + instrumentSubCategory + "\\" + instrumentName;
                    if (itemName == itemName1)
                    {
                        StatisticsListView.Items[x].Remove();
                    }
                }
                foreach (Object statisticsItem in StatisticsArrayList)
                {
                    StatisticsListItem dd   = (StatisticsListItem)statisticsItem;
                    string             name = dd.ItemName;
                    if (name == itemName1)
                    {
                        StatisticsArrayList.Remove(statisticsItem);
                        break;
                    }
                }
                break;

            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                for (int x = 0; x < StatisticsListView.Items.Count; x++)
                {
                    string instrumentName        = StatisticsListView.Items[x].Text;
                    string instrumentCategory    = StatisticsListView.Items[x].SubItems[1].Text;
                    string instrumentSubCategory = StatisticsListView.Items[x].SubItems[2].Text;
                    string instrumentDescription = StatisticsListView.Items[x].SubItems[3].Text;
                    string itemName = instrumentCategory + "\\" + instrumentSubCategory + "\\" + instrumentName;
                    if (itemName == itemName1)
                    {
                        StatisticsListView.Items[x].Remove();
                    }
                }
                foreach (Object statisticsItem in StatisticsArrayList)
                {
                    StatisticsListItem dd   = (StatisticsListItem)statisticsItem;
                    string             name = dd.ItemName;
                    if (name == item.Text)
                    {
                        StatisticsArrayList.Remove(statisticsItem);
                        break;
                    }
                }
                break;
            }
        }
示例#4
0
        private int performStatistics(int fromSession, int toSession, int fromPatiant, int toPatiant)
        {
            int      statisticsCounter = 0;
            MainForm mainForm          = (MainForm)this.parentForm;
            int      numOfSessions     = mainForm.numOfSessions;
            int      fromMinute        = Convert.ToInt16(this.FromMinuteNumericUpDown.Value) * 2;
            int      toMinute          = Convert.ToInt16(this.ToMinuteNumericUpDown.Value) * 2;

            for (int listCounter = 0; listCounter < StatisticsArrayList.Count; listCounter++)
            {
                StatisticsListItem statisticsItem = (StatisticsListItem)StatisticsArrayList[listCounter];
                switch (statisticsItem.ItemType)
                {
                case 1:    //instrument
                    for (int docCounter = fromSession; docCounter <= toSession; docCounter++)
                    {
                        for (int patiantCounter = fromPatiant; patiantCounter < toPatiant /*mainForm.SessionsArray[numOfSessions].document[docCounter].numOfPatiants*/; patiantCounter++)
                        {
                            bool dontCountThisPatiant = false;
                            foreach (CheckBox checkbox in checkBoxPanel.Controls)
                            {
                                if (mainForm.SessionsArray[numOfSessions].document[docCounter].timeLine[patiantCounter].PatiantName == checkbox.Text && checkbox.Checked == false)
                                {
                                    dontCountThisPatiant = true;
                                }
                            }
                            if (dontCountThisPatiant)
                            {
                                continue;
                            }
                            for (int minutesCounter = fromMinute; minutesCounter < /*mainForm.SessionsArray[numOfSessions].document[docCounter].sessionDuration * 2*/ toMinute; minutesCounter++)
                            {
                                if (mainForm.SessionsArray[numOfSessions].document[docCounter].timeLine[patiantCounter].MinutesArray[minutesCounter].instrumentStartHere)
                                {
                                    InstrumentInfo instrument = (InstrumentInfo)mainForm.SessionsArray[numOfSessions].document[/*mainForm.SessionsArray[numOfSessions].docNumber*/ docCounter].timeLine[patiantCounter].MinutesArray[minutesCounter].instrumetnInfo;

                                    //myImage my_image = (myImage)imageList[imageCounter];
                                    string instrName = instrument.Category + "\\" + instrument.SubCategory + "\\" + instrument.Name;
                                    if (statisticsItem.ItemName == instrName)
                                    {
                                        statisticsCounter++;
                                    }
                                }
                            }
                        }
                    }
                    break;

                case 2:    //text
                    for (int patiantCounter = 0; patiantCounter < mainForm.SessionsArray[numOfSessions].document[mainForm.SessionsArray[numOfSessions].docNumber].numOfPatiants; patiantCounter++)
                    {
                        for (int minutesCounter = 0; minutesCounter < mainForm.SessionsArray[numOfSessions].document[mainForm.SessionsArray[numOfSessions].docNumber].sessionDuration * 2; minutesCounter++)
                        {
                            if (mainForm.SessionsArray[numOfSessions].document[mainForm.SessionsArray[numOfSessions].docNumber].timeLine[patiantCounter].MinutesArray[minutesCounter].topicAndSubTopic == statisticsItem.ItemName)
                            {
                                statisticsCounter++;
                            }
                        }
                    }
                    break;

                case 3:     //arrow

                    break;

                case 4:     //disc
                    for (int docCounter = fromSession; docCounter <= toSession; docCounter++)
                    {
                        for (int x = 0; x < mainForm.SessionsArray[numOfSessions].document[docCounter].DiscList.Count; x++)
                        {
                            Disc disc = (Disc)mainForm.SessionsArray[numOfSessions].document[docCounter].DiscList[x];
                            if (disc.startPoint >= fromMinute && disc.startPoint <= toMinute)
                            {
                                statisticsCounter++;
                            }
                        }
                    }
                    break;

                case 5:    //sing
                    for (int docCounter = fromSession; docCounter <= toSession; docCounter++)
                    {
                        for (int x = 0; x < mainForm.SessionsArray[numOfSessions].document[docCounter].SingScreamList.Count; x++)
                        {
                            SingSinusAndScreamZigzag sing = (SingSinusAndScreamZigzag)mainForm.SessionsArray[numOfSessions].document[docCounter].SingScreamList[x];
                            if (sing.startPoint >= fromMinute && sing.startPoint <= toMinute && sing.type == 1)
                            {
                                bool dontCountThisPatiant = false;
                                foreach (CheckBox checkbox in checkBoxPanel.Controls)
                                {
                                    if (mainForm.SessionsArray[numOfSessions].document[docCounter].timeLine[sing.patiantNumber].PatiantName == checkbox.Text && checkbox.Checked == false)
                                    {
                                        dontCountThisPatiant = true;
                                    }
                                }
                                if (dontCountThisPatiant)
                                {
                                    continue;
                                }

                                statisticsCounter++;
                            }
                        }
                    }
                    break;

                case 6:    //scream
                    for (int docCounter = fromSession; docCounter <= toSession; docCounter++)
                    {
                        for (int x = 0; x < mainForm.SessionsArray[numOfSessions].document[docCounter].SingScreamList.Count; x++)
                        {
                            SingSinusAndScreamZigzag sing = (SingSinusAndScreamZigzag)mainForm.SessionsArray[numOfSessions].document[docCounter].SingScreamList[x];
                            if (sing.startPoint >= fromMinute && sing.startPoint <= toMinute && sing.type == 2)
                            {
                                bool dontCountThisPatiant = false;
                                foreach (CheckBox checkbox in checkBoxPanel.Controls)
                                {
                                    if (mainForm.SessionsArray[numOfSessions].document[docCounter].timeLine[sing.patiantNumber].PatiantName == checkbox.Text && checkbox.Checked == false)
                                    {
                                        dontCountThisPatiant = true;
                                    }
                                }
                                if (dontCountThisPatiant)
                                {
                                    continue;
                                }

                                statisticsCounter++;
                            }
                        }
                    }
                    break;

                case 7:    //silence
                    for (int docCounter = fromSession; docCounter <= toSession; docCounter++)
                    {
                        for (int x = 0; x < mainForm.SessionsArray[numOfSessions].document[docCounter].SilencePanelList.Count; x++)
                        {
                            SilencePanel silence = (SilencePanel)mainForm.SessionsArray[numOfSessions].document[docCounter].SilencePanelList[x];
                            if (silence.startPoint >= fromMinute && silence.startPoint <= toMinute)
                            {
                                statisticsCounter++;
                            }
                        }
                    }
                    break;
                }
            }

            return(statisticsCounter);
        }