public static List<TypeIndexAssociation> GenerateTypePath(FrameworkElement element)
        {
            List<TypeIndexAssociation> typePath = new List<TypeIndexAssociation>();
            while (element != null)
            {
                int index = 0;

                if (VisualTreeHelper.GetParent(element) != null)
                {
                    DependencyObject parent = VisualTreeHelper.GetParent(element);

                    if (parent is Panel)
                    {
                        index = ((Panel)parent).Children.IndexOf(element);
                    }
                }

                typePath.Add(new TypeIndexAssociation() { ElementType = element.GetType(), Index = index });

                element = VisualTreeHelper.GetParent(element) as FrameworkElement;
            }

            typePath.Reverse();
            return typePath;
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var viewModel = value as ItemHoverViewModel;

            if (viewModel == null || !viewModel.HasRequirements)
            {
                return null;
            }

            var paragraph = new Paragraph();

            foreach (var requirement in viewModel.Requirements)
            {
                var runs = new List<Run>
                {
                    new Run(requirement.Name) {Foreground = Brushes.Gray},
                    new Run(" ") {Foreground = Brushes.Gray},
                    new Run(requirement.Value) {Foreground = Brushes.White}
                };

                if (!requirement.NameFirst)
                    runs.Reverse();

                if (paragraph.Inlines.Count > 0)
                {
                    paragraph.Inlines.Add(new Run(", ") { Foreground = Brushes.Gray });
                }

                paragraph.Inlines.AddRange(runs);
            }

            paragraph.Inlines.InsertBefore(paragraph.Inlines.FirstInline, new Run("Requires ") { Foreground = Brushes.Gray });

            return new FlowDocument(paragraph);
        }
Beispiel #3
0
        public BookmarkEditor(Comisor.MainWindow mainWindow, string strName, string strPath, string strCurrentPath = "")
        {
            InitializeComponent();

            this.main = mainWindow;
            this.Title = Comisor.Resource.Bookmark_Editor;
            lbName.Content = Comisor.Resource.Bookmark_Name + ":";
            lbPath.Content = Comisor.Resource.Bookmark_FilePath + ":";

            List<string> nameOption = new List<string>();
            nameOption.AddRange(strPath.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries));
            nameOption.Reverse();
            nameOption.Insert(0, strName);
            ys.DataProcessor.RemoveSame(ref nameOption);
            cbName.ItemsSource = nameOption;
            cbName.SelectedIndex = 0;

            List<string> pathOption = new List<string>();
            pathOption.Add(strPath);
            if (strCurrentPath != "") pathOption.Add(strCurrentPath);
            ys.DataProcessor.RemoveSame(ref pathOption);
            cbPath.Focus();
            cbPath.ItemsSource = pathOption;
            cbPath.SelectedIndex = 0;

            ckbShortcut.Content = Comisor.Resource.Bookmark_CreatShortcut;

            btnOK.Content = mainWindow.resource.imgOK;
            btnCancel.Content = mainWindow.resource.imgCancel;

            this.PreviewKeyDown += new KeyEventHandler(InputBox_PreviewKeyDown);
        }
        public void SayActionErrors(List<Pose.JointError> errorList, int nFrames)
        {
            errorList.Sort((s1, s2) => s1.mag.CompareTo(s2.mag));
            errorList.Reverse();

            Dictionary<string, int> errorDict = new Dictionary<string, int>();

            for (int i = 0; i < errorList.Count; i++)
            {
                string text = "";
                Pose.JointError err = errorList[i];
                text += "Your " + getStringFromJointType(err.joint) + " was " + getStringFromErrorType(err.error);
                if (err.frame < nFrames / 3)
                {
                    text += " at the beginning.  ";
                }
                else if (err.frame < 2 * nFrames / 3)
                {
                    text += " during the middle.  ";
                }
                else
                {
                    text += " near the end.  ";
                }

                if (errorDict.ContainsKey(text))
                {
                    errorDict[text] += 1;
                }
                else
                {
                    errorDict[text] = 1;
                }
            }

            List<string> comments = errorDict.Keys.ToList();
            comments.Sort((k1, k2) => errorDict[k1].CompareTo(errorDict[k2]));
            comments.Reverse();

            string speech = "";
            for (int i = 0; i < Math.Min(numberErrorsMentioned, comments.Count); i++)
            {
                if (errorDict[comments[i]] < frameErrorMinimum)
                {
                    break;
                }
                speech += comments[i];
            }

            if (speech.Equals(""))
            {
                speech = "No significant errors found.";
            }

            Speak(speech);
        }
 void LoadListData()
 {
     ManageAppBarButtons();
     MainViewModel mvm = new MainViewModel();
     List<DictionaryRecord> data = new List<DictionaryRecord>(list);
     switch (list.SortOrder)
     {
         case DictionaryRecordList.ListSortOrder.ReverseChronological:
             data.Reverse();
             break;
         case DictionaryRecordList.ListSortOrder.Alphabetical:
         default:
             data.Sort();
             break;
     }
     mvm.LoadData(data);
     this.DataContext = mvm;
 }
Beispiel #6
0
        public void showChart()
        {
            int tempNumber1 = getResult(DateTime.Now.Year.ToString());
            int tempNumber2 = getResult((DateTime.Now.Year-1).ToString());
            List<KeyValuePair<string, int>> valueList = new List<KeyValuePair<string, int>>();
            List<KeyValuePair<string, int>> valueList2 = new List<KeyValuePair<string, int>>();
            List<KeyValuePair<string, double>> valueListFinal = new List<KeyValuePair<string, double>>();
            List<KeyValuePair<string, double>> valueListFinal2 = new List<KeyValuePair<string, double>>();
            var dataSourceList = new List<List<KeyValuePair<string,double>>>();

            valueList = Controller.salesStatistics[DateTime.Now.Year.ToString()];
            valueList.Reverse();
            valueList2 = Controller.salesStatistics[(DateTime.Now.Year - 1).ToString()];
            valueList2.Reverse();

            foreach (var item in valueList)
            {
                double temp1 = 0;
                temp1 = item.Value;
                temp1 = temp1 / tempNumber2;
                temp1 = temp1 * 100;

                valueListFinal.Add(new KeyValuePair<string, double>(item.Key, Math.Round(temp1)));
            }
            foreach (var item in valueList2)
            {
                double temp2 = 0;
                temp2 = item.Value;
                temp2 = temp2 / tempNumber1;
                temp2 = temp2 * 100;

                valueListFinal2.Add(new KeyValuePair<string, double>(item.Key, Math.Round(temp2)));
            }
            dataSourceList.Add(valueListFinal);
            dataSourceList.Add(valueListFinal2);

            columnChart.DataContext = dataSourceList;
            et.Title = DateTime.Now.Year.ToString();
            to.Title = (DateTime.Now.Year - 1).ToString();
            columnChart.BorderThickness = new Thickness(0, 0, 0, 0);
            saleLbl.Content = "Salgsstatistik for " + (DateTime.Now.Year - 1).ToString() + "/" + DateTime.Now.Year.ToString();
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Requirement requirement = value as Requirement;

            Run name = new Run(requirement.Name) { Foreground = Brushes.Gray };
            Run v = new Run(requirement.Value) { Foreground = Brushes.White, FontWeight = FontWeights.Bold };

            Paragraph paragraph = new Paragraph();

            List<Run> runs = new List<Run>();
            runs.Add(name);
            runs.Add(new Run(" ") { Foreground = Brushes.Gray });
            runs.Add(v);

            if (!requirement.NameFirst)
                runs.Reverse();

            paragraph.Inlines.Add(new Run("Requires ") { Foreground = Brushes.Gray });
            paragraph.Inlines.AddRange(runs);

            return new FlowDocument(paragraph);
        }
        public AllNodesWindow(List<Node> results, int expanded, int total)
        {
            InitializeComponent();
            expandedCount.Text += expanded.ToString();
            genCount.Text += total.ToString();
            List<Data> source = new List<Data>();
            int count = 0;
            foreach (Node n in results)
            {
                source.Add(new Data()
                {
                    rowNum = ++count,
                    hValue = n.hValue,
                    gValue = n.gValue,
                    fValue = n.fValue,
                    action = n.action,
                    state = stringifyState(n),
                    thisNode = n
                });

            }
            grid.ItemsSource = source.Reverse<Data>();
            //grid.DataContext = results[0];
        }
        private void deleteGroup_Click(object sender, RoutedEventArgs e)
        {
            if (m_currentGroup != null)
            {
                //remove entries with m_currentGroup
                List<int> indices = new List<int>();
                for (int i = 0; i < m_entryItems.Count;i++ )
                {
                    if (m_entryItems[i].Entry.Group == m_currentGroup)
                        indices.Add(i);
                }
                indices.Reverse();
                foreach (int i in indices)
                {
                    m_entryItems.RemoveAt(i);
                }

                //delete group
                DictionaryEntities.Singleton.Groups.DeleteObject(m_currentGroup);
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            List<int> card_number_array = new List<int>();
            if (validatenumber(CreditCardNumber.Text, out card_number_array) == true) //Checks to see if actual number
            {
                card_number_array.Reverse();
                if (luhn_checksum(card_number_array)) //Checks input number
                {
                    ValidationTest.Foreground = Brushes.Green;
                    ValidationTest.Content = "Number passes the Luhn Algorithm";
                    string[] bankNames = GetInformation(CreditCardNumber.Text);  //Get bank & card info
                    Type.Content = "Type: " + bankNames[1];                      //Displays info
                    Bank.Content = "Issuing Bank: " + bankNames[2];
                    ValidationTest.Visibility = Visibility.Visible;
                    Type.Visibility = Visibility.Visible;
                    Bank.Visibility = Visibility.Visible;
                }
                else
                {
                    ValidationTest.Foreground = Brushes.Red;                    //Displays algorithm failed messages
                    ValidationTest.Content = "Number fails the Luhn Algorithm";
                    ValidationTest.Visibility = Visibility.Visible;
                }

            }
            else
            {
                ValidationTest.Content = "Invalid input";
            }
        }
Beispiel #11
0
        /*
         * Errechnet den Score anhand der Anzahl gelöschten Zeile und der Höhe
         */
        private int calcScore(List<int> linesToRemove)
        {
            linesToRemove.Reverse();
            double tmpScore = 0;

            for (int i = 1; i <= linesToRemove.Count; i++)
            {
                switch (getLevel())
                {
                    case 0: tmpScore += Math.Pow(50 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                    case 1: tmpScore += Math.Pow(100 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                    case 2: tmpScore += Math.Pow(150 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                    case 3: tmpScore += Math.Pow(200 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                    case 4: tmpScore += Math.Pow(250 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                    case 5: tmpScore += Math.Pow(300 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                    case 6: tmpScore += Math.Pow(350 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                    case 7: tmpScore += Math.Pow(400 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                    case 8: tmpScore += Math.Pow(450 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                    case 9: tmpScore += Math.Pow(500 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
                }
            }
            return (int)tmpScore;
        }
        public List<Record> getRecordList(int option)
        {
            List<Record> refNoSet = new List<Record>();
            string StrCmd;
            switch (option)
            {
                case (0):
                    {
                        StrCmd = "SELECT top " + (MainWindow.listsize + 1) + " reportNo, patientName,gender, ward, bht, age, months, specimen,testDate,severity FROM Table1 where testdate >= '" + MainWindow.topdate + "' AND iif(testdate = '" + MainWindow.topdate + "' ,dateid > " + MainWindow.topid + ",1) AND" + MainWindow.searchPhrase + " order by testdate asc,dateid ASC";
                        break;
                    }
                case (1):
                default:
                    {
                        if (MainWindow.bottomdate != "")
                            StrCmd = "SELECT top " + (MainWindow.listsize + 1) + " reportNo, patientName,gender, ward, bht, age, months, specimen,testDate,severity FROM Table1 where testdate <= '" + MainWindow.bottomdate + "' AND iif(testdate = '" + MainWindow.bottomdate + "' ,dateid <= " + MainWindow.bottomid + ",1) AND" + MainWindow.searchPhrase + " order by testdate desc,dateid DESC";
                        else
                            StrCmd = "SELECT top " + (MainWindow.listsize + 1) + " reportNo, patientName,gender, ward, bht, age, months, specimen,testDate,severity FROM Table1 WHERE " + MainWindow.searchPhrase + " order by testdate desc, dateid desc";
                        break;
                    }
            }
            OleDbCommand Cmd = new OleDbCommand(StrCmd, MyConn);
            OleDbDataReader ObjReader = Cmd.ExecuteReader();
            String name, gender, date, reportNo, bht, ward, severity;
            String[] specimen;
            int age, months;

            while (ObjReader.Read())
            {
                name = ObjReader["patientName"].ToString();
                gender = ObjReader["gender"].ToString();
                ward = ObjReader["ward"].ToString();
                bht = ObjReader["bht"].ToString();
                date = ObjReader["testDate"].ToString();
                reportNo = ObjReader["reportNo"].ToString();
                severity = ObjReader["severity"].ToString();        //**
                age = Int32.Parse(ObjReader["age"].ToString());
                months = Int32.Parse(ObjReader["months"].ToString());
                specimen = Record.StringToArray(ObjReader["specimen"].ToString());
                refNoSet.Add(new Record(reportNo, ward, bht, "", name, age, months, gender, specimen, "", "", "", date, "", severity, ""));
            }
            if (refNoSet.Count > 0)
            {
                int tmp = MainWindow.topid;
                string temp = MainWindow.topdate;
                string StrCmd2;
                if (option == 1)
                    StrCmd2 = "SELECT * FROM Table1 WHERE reportNo = '" + refNoSet.Last().Reference_No + "'";
                else
                    StrCmd2 = "SELECT * FROM Table1 WHERE reportNo = '" + refNoSet[(MainWindow.listsize - 1)].Reference_No + "'";
                string StrCmd3 = "SELECT * FROM Table1 WHERE reportNo = '" + refNoSet.First().Reference_No + "'";
                OleDbCommand Cmd2 = new OleDbCommand(StrCmd2, MyConn);
                OleDbDataReader ObjReader2 = Cmd2.ExecuteReader();
                if (ObjReader2 == null)
                {
                    MainWindow.hasmore = false;
                    Console.WriteLine();////////////////////////////////////error in connecting to the database
                    return null;
                }
                else
                {
                    ObjReader2.Read();
                    MainWindow.bottomdate = ObjReader2["testdate"].ToString();
                    MainWindow.bottomid = Int32.Parse(ObjReader2["dateid"].ToString());
                    OleDbCommand Cmd3 = new OleDbCommand(StrCmd3, MyConn);
                    OleDbDataReader ObjReader3 = Cmd3.ExecuteReader();
                    if (ObjReader3 == null)
                    {
                        MainWindow.hasmore = false;
                        Console.WriteLine();////////////////////////////////////error in connecting to the database
                        return null;
                    }
                    else
                    {
                        ObjReader3.Read();
                        MainWindow.topdate = ObjReader3["testdate"].ToString();
                        MainWindow.topid = Int32.Parse(ObjReader3["dateid"].ToString());
                    }
                    if (refNoSet.Count == (MainWindow.listsize + 1))
                    {
                        MainWindow.hasmore = true;
                        refNoSet.Remove(refNoSet.Last());
                    }
                    else
                        MainWindow.hasmore = false;
                    if (option == 0)
                    {
                        MainWindow.topdate = MainWindow.bottomdate;
                        MainWindow.bottomdate = temp;
                        MainWindow.topid = MainWindow.bottomid;
                        MainWindow.bottomid = tmp;
                        refNoSet.Reverse();
                    }
                    return refNoSet;
                }
            }
            else
            {
                MainWindow.hasmore = false;
                return null;
            }
        }
 void OnConnectNodesCommandExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     using (EditingScope es = (EditingScope)this.ModelItem.BeginEdit(SR.FCCreateLink))
     {
         List<ModelItem> selectedFlowchartItems = new List<ModelItem>(this.Context.Items.GetValue<Selection>().SelectedObjects);
         selectedFlowchartItems.Reverse();
         CreateLinks(selectedFlowchartItems);
         es.Complete();
     }
 }
Beispiel #14
0
        private void get_to_new_condition(City_E newmaincity)
        {
            List<City_E> Oldlist = cities_EL;
            maincity_e.is_centralcity = false;
            newmaincity.is_centralcity = true;
               // maincity_e = newmaincity;
            City_E oldmaincity=maincity_e;
            time_circle.tc_e.MouseLeftButtonDown -= tc_e_MouseLeftButtonDown;
            time_circle.tc_e.MouseMove -= ellipse_MouseMove;
            time_circle.tc_e.MouseLeftButtonUp -= ellipse_MouseLeftButtonUp;
            canvas1.MouseWheel-= canvas1_MouseWheel;
            canvas1.MouseLeftButtonDown -= canvas1_MouseLeftButtonDown;
            canvas1.MouseMove -= canvas1_MouseMove;
            canvas1.MouseLeftButtonUp -= canvas1_MouseLeftButtonUp;
            bu_change.button.Click -= changebutton_MouseLeftButtonDown;

            for (int i = 0; i < cities_EL.Count; i++)
            {
             //       if (cities_EL[i] != chosencity)
                {
                    canvas1.Children.Remove(cities_EL[i].ellipse);
                    canvas1.Children.Remove(cities_EL[i].line_entity);
                    canvas1.Children.Remove(cities_EL[i].textblock);
                    cities_EL[i].ellipse.MouseEnter -= city_e_MouseEnter;
                    cities_EL[i].ellipse.MouseLeave -= ellipse_e_MouseLeave;
                    cities_EL[i].ellipse.MouseLeftButtonDown -= ellipse_MouseLeftButtonDown;
                    cities_EL[i].ellipse.MouseMove -= ellipse_MouseMove;
                    cities_EL[i].ellipse.MouseLeftButtonUp -= ellipse_MouseLeftButtonUp;
                }
            }
               cities_EL = new List<City_E>();

               position_compute.angle_set = 0;
               position_compute.now_set_color_number = 0;
               for (int i = 0; i < Oldlist.Count; i++)
               {
               cities_EL.Add(Oldlist[i]);
               if (cities_EL[i].is_centralcity == true)//set new maincity
                   maincity_e = cities_EL[i];

              //     cities_EL[i].create_linetomaincity(10, 10, canvas1);
               cities_EL[i].create_ellipse_oncavas(canvas1, cities_EL[i].x_center, cities_EL[i].y_center);

               position_compute.set_ellipse_fillbrushcolor(cities_EL[i]);
               }

            //animation
               sb = new Storyboard();
               maincity_e.addellipse_to_storyBoard(sb, oldmaincity.x_center, oldmaincity.y_center);
               sb.Begin();  //make the maincity to center

               for (int i = 0; i < cities_EL.Count; i++)
               {
               random_set_citytime_value(cities_EL[i]);
            }
               cities_EL.Reverse();

               Storyboard sb1 = new Storyboard();
               position_compute.angle_set = 0;
               position_compute.cities_number = cities_EL.Count;
               for (int i = 0; i < cities_EL.Count; i++)
               {
               if (cities_EL[i] != maincity_e)
               {
                   double angle1 = position_compute.angle_compute();
                   cities_EL[i].angle_remember = angle1;
                   double dx1 = position_compute.compute_x_relatetomaincity(cities_EL[i].actual_distance[cities_EL[i].which_distance], maincity_e.x_center, angle1);
                   double dy1 = position_compute.compute_Y_relateto_maincity(cities_EL[i].actual_distance[cities_EL[i].which_distance], maincity_e.y_center, angle1);
                   cities_EL[i].angle_remember = angle1;
                  cities_EL[i].addellipse_to_storyBoard(sb1, dx1, dy1);
                   //cities_EL[i].set_line_position(maincity_e.x_center, maincity_e.y_center, dx1 + 12.5, dy1 + 12.5);
               }
              }
            sb1.BeginTime=TimeSpan.FromSeconds(0.65);
               sb1.Begin();

              //set line
               Storyboard sb2 = new Storyboard();
               for (int i = 0; i < cities_EL.Count; i++)
               {
               cities_EL[i].create_linetomaincity(maincity_e.x_center, maincity_e.y_center, canvas1);
               cities_EL[i].line_entity.X1 = maincity_e.x_center;
               cities_EL[i].line_entity.X2 = maincity_e.x_center;
               cities_EL[i].line_entity.Y1 = maincity_e.y_center;
               cities_EL[i].line_entity.Y2 = maincity_e.y_center;
               cities_EL[i].line_entity.Opacity=0;
               if(cities_EL[i].is_centralcity==false)
               cities_EL[i].set_line_position(maincity_e.x_center, maincity_e.y_center, cities_EL[i].x_center, cities_EL[i].y_center);
               cities_EL[i].ellipse.MouseEnter += new MouseEventHandler(city_e_MouseEnter);
               cities_EL[i].ellipse.MouseLeave += new MouseEventHandler(ellipse_e_MouseLeave);
               cities_EL[i].ellipse.MouseLeftButtonDown += new MouseButtonEventHandler(ellipse_MouseLeftButtonDown);
               cities_EL[i].ellipse.MouseMove += new MouseEventHandler(ellipse_MouseMove);
               cities_EL[i].ellipse.MouseLeftButtonUp += new MouseButtonEventHandler(ellipse_MouseLeftButtonUp);
               if(cities_EL[i]!=maincity_e)
                   cities_EL[i].is_centralcity = false;
               cities_EL[i].add_line_storyboard(sb2);
            }
            sb2.BeginTime=TimeSpan.FromSeconds(1.4);
            sb2.Begin();

               time_circle.tc_e.MouseLeftButtonDown += new MouseButtonEventHandler(tc_e_MouseLeftButtonDown);
               time_circle.tc_e.MouseMove += new MouseEventHandler(ellipse_MouseMove);
               time_circle.tc_e.MouseLeftButtonUp += new MouseButtonEventHandler(ellipse_MouseLeftButtonUp);
               canvas1.MouseWheel += new MouseWheelEventHandler(canvas1_MouseWheel);
               canvas1.MouseLeftButtonDown += new MouseButtonEventHandler(canvas1_MouseLeftButtonDown);
               canvas1.MouseMove += new MouseEventHandler(canvas1_MouseMove);
               canvas1.MouseLeftButtonUp += new MouseButtonEventHandler(canvas1_MouseLeftButtonUp);

               bu_change.button.Click += new RoutedEventHandler(changebutton_MouseLeftButtonDown);
               moveanimation.listtargetcities = cities_EL;
               moveanimation.target_circle = time_circle;

               canvas1.Children.Remove(panel_info.stackpanel);
               canvas1.Children.Remove(panel_info.stackpanel2);
               canvas1.Children.Add(panel_info.stackpanel);
               canvas1.Children.Add(panel_info.stackpanel2);
               showway_flag = 0;
               lineway_support.disappear();
               panel_info.disappear();
               bu_change.disapear();
        }
        private void GetBreadCrumbItems(List<ShellObject> items)
        {
            ShellObject lastmanstanding = items[0];
            items.Reverse();
            

            foreach (ShellObject thing in items)
            {
                bool isSearch = false;
                try 
	            {
                    isSearch = thing.IsSearchFolder;
	            }
	            catch 
	            {
		            isSearch = false;
	            }
                BreadcrumbBarItem duh = new BreadcrumbBarItem();
                if (!isSearch)
                {
                    duh.LoadDirectory(thing);
                    
                }
                else
                {
                    thing.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
                    thing.Thumbnail.CurrentSize = new Size(16, 16);
                    duh.pathName.Text = thing.GetDisplayName(DisplayNameType.Default);
                    duh.PathImage.Source = thing.Thumbnail.BitmapSource;
                    duh.MenuBorder.Visibility = System.Windows.Visibility.Collapsed;
                    duh.grid1.Visibility = System.Windows.Visibility.Collapsed;
                    
                }

                
                
                duh.NavigateRequested += new BreadcrumbBarItem.PathEventHandler(duh_NavigateRequested);

                this.stackPanel1.Children.Add(duh);
                
                if (thing == lastmanstanding)
                {
                    furthestrightitem = duh;
                    duh.BringIntoView();
                }
               
            }
        }
        public void visualisePlanes(List<List<Point3D>> planes, double planeIndex)
        {
            //Set relevant UI components to visisble
            bodyimg.Visibility = Visibility.Visible;
            planeNo.Visibility = Visibility.Visible;
            viewborder.Visibility = Visibility.Visible;
            hvpcanvas.Visibility = Visibility.Visible;
            planeChooser.Visibility = Visibility.Visible;
            vollabel.Visibility = Visibility.Visible;
            voLconclabel.Visibility = Visibility.Visible;
            voloutput.Visibility = Visibility.Visible;
            heightlabel.Visibility = Visibility.Visible;
            heightoutput.Visibility = Visibility.Visible;
            otherlabel.Visibility = Visibility.Visible;
            scanno.Visibility = Visibility.Visible;
            scantime.Visibility = Visibility.Visible;
            scanfileref.Visibility = Visibility.Visible;
            scanvoxel.Visibility = Visibility.Visible;
            maxarea.Visibility = Visibility.Visible;
            totalarea.Visibility = Visibility.Visible;
            totalperimiter.Visibility = Visibility.Visible;
            btnresults.Visibility = Visibility.Visible;
            btnrescan.Visibility = Visibility.Visible;

            //Set relevant ui components to collapsed
            noresults.Visibility = Visibility.Collapsed;
            newscan.Visibility = Visibility.Collapsed;
            scanno.Content = "Scan No: 1";

            planeNo.Text = "Plane Outline: " + (int)planeIndex;

            System.Diagnostics.Debug.WriteLine("Number of caught planes: " + planes.Count);

            if (storedPlanes.Count == 0)
            {
                storedPlanes = planes;
                storedPlanes.Reverse();
                planeChooser.Maximum = storedPlanes.Count;
            }

            double xmin = 0;
            double xmax = 0;
            double zmin = 0;
            double zmax = 0;

            int i = (int)planeIndex;

            double[] x = new double[storedPlanes[i].Count];
            double[] z = new double[storedPlanes[i].Count];

            for (int j = 0; j < storedPlanes[i].Count; j++)
            {

                //Boundary check of points.
                if (storedPlanes[i][j].X > xmax)
                {
                    xmax = storedPlanes[i][j].X;
                }

                if (storedPlanes[i][j].Z > zmax)
                {
                    zmax = storedPlanes[i][j].Z;
                }

                if (storedPlanes[i][0].X < xmin)
                {
                    xmin = storedPlanes[i][0].X;
                }
                if (storedPlanes[i][j].X < xmin)
                {
                    xmin = storedPlanes[i][j].X;
                }

                if (storedPlanes[i][0].Z < zmin)
                {
                    zmin = storedPlanes[i][0].Z;
                }
                if (storedPlanes[i][j].Z < zmin)
                {
                    zmin = storedPlanes[i][j].Z;
                }

                //assign to arrays
                x[j] = storedPlanes[i][j].X;
                z[j] = storedPlanes[i][j].Z;

            }

            //write points to plane renderer class for visualisation.
            this.DataContext = new PlaneVisualisation(x, z);

            System.Diagnostics.Debug.WriteLine("Planes visualised");
            System.Diagnostics.Debug.WriteLine("xmin: " + xmin);
            System.Diagnostics.Debug.WriteLine("zmin: " + zmin);
            System.Diagnostics.Debug.WriteLine("xmax: " + xmax);
            System.Diagnostics.Debug.WriteLine("zmax: " + zmax);
        }
Beispiel #17
0
        private void GoCheckUpdate()
        {
            updateBox.RemoteClick();
            string version = string.Empty;
            /**************************************/
            Action<CheckResult, string> action = (dic, msg) =>
            {
                switch (dic)
                {
                    case CheckResult.None:

                        break;
                    case CheckResult.HasNew:
                        UpdateResult = update.Data.versionlist.First();
                        //修改更新结果顺序错误问题
                        version = UpdateResult.version;
                        //if (version.Contains("_release"))
                        //{
                        //    version.Replace("_release", "");
                        //}
                        version = version.Split('_')[0];
                        //ICE测试
                        List<string> ListUrl = new List<string>();
                        if (isTest)
                        {
                            ListUrl.Add(update.Data.versionlist[3].addr);
                            ListUrl.Add(update.Data.versionlist[3].addr);
                            ListUrl.Add(update.Data.versionlist[3].addr);
                            ListUrl.Add(update.Data.versionlist[3].addr);
                            ListUrl.Add(update.Data.versionlist[3].addr);
                        }
                        else
                        {
                            List<Tvm.WPF.TvmUpdate.vs> ListVs = new List<TvmUpdate.vs>();
                            foreach (var item in update.Data.versionlist)
                            {
                                ListVs.Add(item);
                            }
                            ListVs.Reverse();
                            foreach (var item in ListVs)
                            {
                                ListUrl.Add(item.addr);
                            }
                        }
                        //测试zip

                        CheckVersion(UpdateResult.version, ListUrl);

                        break;
                    case CheckResult.HasNotNew:
                        Warning.WarningText = "当前没有可用的更新补丁。";
                        int a = 3;
                        break;
                    case CheckResult.TimeOut:
                        Warning.WarningText = "请求超时。";
                        break;
                    default:
                        break;
                }
            };
            update.BeginCheck(action);
            /***************************************/
        }
        /// <summary>
        /// Generates the palette.
        /// </summary>
        /// <returns></returns>
        private Color[] GeneratePalette()
        {
            List<Color> colors = new List<Color>();

            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, 0xff, 0, (byte)c));
            for (int c = 255; c >= 0; c--)
                colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0xff));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, 0, (byte)c, 0xff));
            for (int c = 255; c >= 0; c--)
                colors.Add(Color.FromArgb(0xff, 0, 0xff, (byte)c));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, 0, (byte)c, 0xff));
            for (int c = 255; c >= 0; c--)
                colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0xff));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, 0xff, 0, (byte)c));
            for (int c = 0; c < 256; c++)
                colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0));

            var half =
                colors.Concat(
                    colors.Reverse<Color>());

            return half.Concat(half).ToArray();
        }
        void MetrocamService_FetchUserPicturesCompleted(object sender, MobileClientLibrary.RequestCompletedEventArgs e)
        {
            App.MetrocamService.FetchUserPicturesCompleted -= MetrocamService_FetchUserPicturesCompleted;

            userPictures = e.Data as List<PictureInfo>;
            userPictures.Reverse();
            App.UserPictures.Clear();

            // If user is still on profilePivot, set loading to false since we have loaded PictureLabel
            if (GlobalLoading.Instance.IsLoading)
                GlobalLoading.Instance.IsLoading = false;

            if (UserPictures.ItemsSource == null)
            {
                this.UserPictures.DataContext = App.UserPictures;
            }

            foreach (PictureInfo p in userPictures)
            {
                p.FriendlyCreatedDate = TimeZoneInfo.ConvertTime(p.FriendlyCreatedDate, TimeZoneInfo.Local);

                if (App.UserPictures.Count < 24)
                {
                    App.UserPictures.Add(p);
                }
                else
                {
                    // Put the rest into ContinuedUserPictures collection
                    ContinuedUserPictures.Add(p);
                }
            }
        }
        public void SayPoseErrors(List<Pose.JointError> errorList)
        {
            string text = "";

            errorList.Sort((s1, s2) => s1.mag.CompareTo(s2.mag));
            errorList.Reverse();

            for (int i = 0; i < Math.Min(numberErrorsMentioned, errorList.Count); i++)
            {
                Pose.JointError err = errorList[i];
                text += "Your " + getStringFromJointType(err.joint) + " is " + getStringFromErrorType(err.error) + ".  ";
            }

            Speak(text);
        }
Beispiel #21
0
        private string MakeSelectionPath(TreeViewItem control)
        {
            List<string> path_components = new List<string>();
            object array_item = null;

            for (FrameworkElement current_control = control; !(current_control is TreeView); current_control = (FrameworkElement)VisualTreeHelper.GetParent(current_control))
            {
                if (!(current_control is TreeViewItem)) continue;

                var attr = current_control.DataContext as AttributeView;
                var cattr = current_control.DataContext as ComparisonDatamodel.Attribute;

                if (attr == null && cattr == null)
                {
                    array_item = current_control.DataContext;
                    continue;
                }
                var name = attr != null ? attr.Key : cattr.Name;
                var value = attr != null ? attr.Value : cattr.Value_Combined;

                IEnumerable array = null;
                if (value != null)
                {
                    var type = value.GetType();
                    if (Datamodel.Datamodel.IsDatamodelArrayType(type) || type.IsArray)
                        array = value as System.Collections.IEnumerable;
                }

                if (array != null)
                {
                    if (array_item == null)
                    {
                        path_components.Add(name);
                        continue;
                    }

                    int i = 0;
                    foreach (var cur in array)
                    {
                        if (cur == array_item)
                        {
                            path_components.Add(name + String.Format("[{0}]", i));
                            array_item = null;
                        }
                        i++;
                    }
                    continue;
                }

                path_components.Add(name);
            }

            if (!String.IsNullOrEmpty(DisplayRootPath)) path_components.Add(DisplayRootPath);
            return "//" + String.Join("/", path_components.Reverse<string>());
        }
Beispiel #22
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            this.busline_page_come_animation.Begin();

            set_panoramaitem_header();

            set_line_shijian();

            string shijian = "";
            if (NavigationContext.QueryString.TryGetValue("shijian", out shijian))
            {
                //ascending_listbox.Items.Add(shijian);
            }

            string xid = "";

            if (NavigationContext.QueryString.TryGetValue("id", out xid))
            {
                //ascending_listbox.Items.Add(xid);
            }

            string select_cmd = "";

            select_cmd = string.Format("select zhan from cnbus where xid = {0} and kind = 1 order by pm", xid);

            if (MainPage.db != null)
            {
                DateTime start = DateTime.Now;
                try
                {
                    //List<Test> lst=new List<Test>();
                    //SQLiteCommand cmd = db.CreateCommand("SELECT xid FROM cnbus where zhan = \'青城桥\'");
                    SQLiteCommand cmd = MainPage.db.CreateCommand(select_cmd);
                    var lst = cmd.ExecuteQuery<Test>();

                    lbOutput.Text += "Selected " + lst.ToList().Count + " items\r\nTime " + (DateTime.Now - start).TotalSeconds;

                    List<string> s_ascending = new List<string>();
                    List<string> s_descending = new List<string>();

                    int i = 0;
                    int j = lst.ToList().Count;
                    foreach (Test temp in lst)
                    {
                        s_ascending.Add(string.Format("{0:00}  {1}", i + 1, temp.zhan));
                        s_descending.Add(string.Format("{0:00}  {1}", j, temp.zhan));

                        i++;
                        j--;

                    }

                    s_descending.Reverse();

                    ascending_listbox.ItemsSource = s_ascending;
                    descending_listbox.ItemsSource = s_descending;

                    lbOutput.Text += "\r\nSelected " + lst.ToList().Count + " items\r\nTime " + (DateTime.Now - start).TotalSeconds;

                }
                catch (SQLiteException ex)
                {

                }
            }
        }
        public void visualiseLimbs(List<Tuple<double, double, List<List<Point3D>>>> limbData, int limbIndex, double planeIndex)
        {
            System.Diagnostics.Debug.WriteLine("Opening Limb Visualisation Panel");
            rawlimbData = limbData;
            maxarea2.Content = "Plane Region: " + planeIndex;

            circumlabel.Visibility = Visibility.Visible;
            circumoutput.Visibility = Visibility.Visible;
            limbselect.Visibility = Visibility.Visible;
            limbselecthdr.Visibility = Visibility.Visible;
            planelabel.Visibility = Visibility.Visible;
            scanlabel.Visibility = Visibility.Visible;
            viewborder2.Visibility = Visibility.Visible;
            noresults2.Visibility = Visibility.Visible;
            newscan2.Visibility = Visibility.Visible;
            scanno2.Visibility = Visibility.Visible;
            scantime2.Visibility = Visibility.Visible;
            scanfileref2.Visibility = Visibility.Visible;
            scanvoxel2.Visibility = Visibility.Visible;
            maxarea2.Visibility = Visibility.Visible;
            totalarea2.Visibility = Visibility.Visible;
            totalperimiter2.Visibility = Visibility.Visible;
            hvpcanvas2.Visibility = Visibility.Visible;
            btnresults2.Visibility = Visibility.Visible;
            btnrescan2.Visibility = Visibility.Visible;

            //Set relevant ui components to collapsed
            noresults2.Visibility = Visibility.Collapsed;
            newscan2.Visibility = Visibility.Collapsed;

            circumoutput.Content = limbData[limbIndex].Item1+"cm";
            totalarea2.Content = "Total Area: " + limbData[limbIndex].Item2;
            totalperimiter2.Content = "Perimeter Approx: " + limbData[limbIndex].Item1+"cm";

            //set ellipse visualisation circumference
            //TODO: add flag for diplaying historic ellipse vis.
            //historicEllipse.Visibility = Visibility.Collapsed;
            historysel.Visibility = Visibility.Collapsed;
            changesel.Visibility = Visibility.Collapsed;

            /*Current Limb Visualisation Code */

            circumsel.Text = "Circum Approx: " + limbData[limbIndex].Item1 + "cm";
            limbsel.Text = "Limb No: " + limbIndex;

            //Set limb view
            limbView.Height = 486 * (limbData[limbIndex].Item1 / 100);
            limbView.Width = 216 * (limbData[limbIndex].Item1 / 100);

            //Set limb visualisation centre
            EllipseGeometry eg = new EllipseGeometry();
            eg.Center = new Point(limbView.Width / 2, limbView.Height / 2);

            scantime2.Content = "Scan Time: " + DateTime.Now.ToString("dd/MM/yy HH:mm");
            scanvoxel2.Content = persistentSiri;
            scanfileref2.Content = persistentBMI;

            //VisCanvas.SetTop(currentEllipse, (VisCanvas.Height/2) - currentEllipse.Height / 2);
            //Canvas.SetLeft(currentEllipse, (VisCanvas.Width/2) - currentEllipse.Width / 2);

            /*End of current limb visualisation code */

            //visualise planes
            planeNo.Text = "Plane Outline: " + (int) planeIndex;

            if (storedLimbPlanes.Count == 0)
            {
                storedLimbPlanes = limbData[limbIndex].Item3;
                storedLimbPlanes.Reverse();
                planeChooser.Maximum = storedLimbPlanes.Count;
            }

            double xmin = 0;
            double xmax = 0;
            double zmin = 0;
            double zmax = 0;

            int i = (int)planeIndex;

            double[] x = new double[storedLimbPlanes[i].Count];
            double[] z = new double[storedLimbPlanes[i].Count];

            for (int j = 0; j < storedLimbPlanes[i].Count; j++)
            {

                //Boundary check of points.
                if (storedLimbPlanes[i][j].X > xmax)
                {
                    xmax = storedLimbPlanes[i][j].X;
                }

                if (storedLimbPlanes[i][j].Z > zmax)
                {
                    zmax = storedLimbPlanes[i][j].Z;
                }

                if (storedLimbPlanes[i][0].X < xmin)
                {
                    xmin = storedLimbPlanes[i][0].X;
                }
                if (storedLimbPlanes[i][j].X < xmin)
                {
                    xmin = storedLimbPlanes[i][j].X;
                }

                if (storedLimbPlanes[i][0].Z < zmin)
                {
                    zmin = storedLimbPlanes[i][0].Z;
                }
                if (storedLimbPlanes[i][j].Z < zmin)
                {
                    zmin = storedLimbPlanes[i][j].Z;
                }

                //assign to arrays
                x[j] = storedLimbPlanes[i][j].X;
                z[j] = storedLimbPlanes[i][j].Z;

            }

            //write points to plane renderer class for visualisation.
            this.DataContext = new PlaneVisualisation(x, z);
        }
            public static Tuple<int, int, int>[] Triangulate(Point[] points)
            {
                int n = points.Length;
                if (n < 3)
                {
                    return new Tuple<int, int, int>[0];
                }

                int[] V = new int[n];
                if (Area_Signed(points) > 0)
                {
                    for (int v = 0; v < n; v++)
                    {
                        V[v] = v;
                    }
                }
                else
                {
                    for (int v = 0; v < n; v++)
                    {
                        V[v] = (n - 1) - v;
                    }
                }

                List<int> retVal = new List<int>();

                int nv = n;
                int count = 2 * nv;
                for (int m = 0, v = nv - 1; nv > 2; )
                {
                    if ((count--) <= 0)
                    {
                        return ConvertToTriples(retVal.ToArray());
                    }

                    int u = v;
                    if (nv <= u)
                    {
                        u = 0;
                    }

                    v = u + 1;
                    if (nv <= v)
                    {
                        v = 0;
                    }

                    int w = v + 1;
                    if (nv <= w)
                    {
                        w = 0;
                    }

                    if (Snip(u, v, w, nv, V, points))
                    {
                        int a = V[u];
                        int b = V[v];
                        int c = V[w];

                        retVal.Add(a);
                        retVal.Add(b);
                        retVal.Add(c);

                        m++;
                        for (int s = v, t = v + 1; t < nv; s++, t++)
                        {
                            V[s] = V[t];
                        }

                        nv--;
                        count = 2 * nv;
                    }
                }

                retVal.Reverse();
                return ConvertToTriples(retVal.ToArray());
            }
        private List<ConnectionPoint> GetAvailableConnectionPoint(UIElement designer)
        {
            List<ConnectionPoint> connectionPoints = new List<ConnectionPoint>(StateContainerEditor.GetConnectionPoints(designer));
            List<ConnectionPoint> usedConnectionPoints = new List<ConnectionPoint>();
            foreach (ConnectionPoint connectionPoint in connectionPoints.Reverse<ConnectionPoint>())
            {
                if (connectionPoint.AttachedConnectors.Count > 0)
                {
                    usedConnectionPoints.Add(connectionPoint);
                    connectionPoints.Remove(connectionPoint);
                }
            }

            // The active connection point may haven't had connector yet
            if (connectionPoints.Contains(this.activeSrcConnectionPoint))
            {
                connectionPoints.Remove(this.activeSrcConnectionPoint);
                usedConnectionPoints.Add(this.activeSrcConnectionPoint);
            }

            foreach (ConnectionPoint connectionPoint in connectionPoints.Reverse<ConnectionPoint>())
            {
                foreach (ConnectionPoint usedConnectionPoint in usedConnectionPoints)
                {
                    if (DesignerGeometryHelper.ManhattanDistanceBetweenPoints(usedConnectionPoint.Location, connectionPoint.Location) < ConnectionPointMargin)
                    {
                        connectionPoints.Remove(connectionPoint);
                        break;
                    }
                }
            }
            return connectionPoints;
        }
Beispiel #26
0
		private List<DependencyObject> CreateResourcesList ()
		{
			var list = new List<DependencyObject> ();

			XamlElement walk = CurrentElement;
			while (walk != null) {
				XamlObjectElement obj = walk as XamlObjectElement;

				if (obj != null) {
					ResourceDictionary rd = obj.Object as ResourceDictionary;
					if (rd != null)
						list.Add (rd);

					FrameworkElement fwe = obj.Object as FrameworkElement;
					if (fwe != null)
						list.Add (fwe);
				}
				
				walk = walk.Parent;
			}

			list.Reverse ();

			return list;
		}
        /// <summary>
        /// Initializes the test case execution times tool tip.
        /// </summary>
        /// <param name="testCaseRunResults">The test case run results.</param>
        /// <returns>test case tooltip</returns>
        private string InitializeTestCaseExecutionTimesToolTip(List<TestCaseRunResult> testCaseRunResults)
        {
            StringBuilder sb = new StringBuilder();
            int count = 1;
            testCaseRunResults.Reverse();
            var lastTenRunResults = testCaseRunResults.Take(10);
            foreach (TestCaseRunResult testCaseRunResult in lastTenRunResults)
            {
                sb.AppendLine(string.Format("{0}. StartDate {1} | EndDate- {2} | Duration- {3} | RunBy- {4}",
                    count++,
                    testCaseRunResult.StartDate.ToShortDateString(),
                    testCaseRunResult.EndDate.ToShortDateString(),
                    testCaseRunResult.Duration.ToString(TimeSpanFormats.HourFormat),
                    testCaseRunResult.RunBy));
            }

            return sb.ToString();
        }
        private void contextMenuCut_Click(object sender, RoutedEventArgs e)
        {
            List<String> tagNames = new List<string>();

            if (selectedTags.Count == 0)
            {
                foreach (Tag tag in Tags)
                {
                    tagNames.Add(tag.Name);
                }
                Tags.Clear();
            }
            else
            {
                for (int i = selectedTags.Count - 1; i >= 0; i--)
                {
                    tagNames.Add((selectedTags[i].Tag as Tag).Name);
                    Tags.Remove(selectedTags[i].Tag as Tag);
                    selectedTags.RemoveAt(i);
                }

                tagNames.Reverse();
            }
                                     
            Clipboard.SetData(tagClipboardDataFormat, tagNames);           
        }
Beispiel #29
0
        private void RichTextBoxContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            List<Control> menuItems = new List<Control>();

            SpellingError spellingError = richTextBox.GetSpellingError(richTextBox.CaretPosition);
            if (spellingError != null)
            {
                foreach (string suggestion in spellingError.Suggestions.Take(5))
                {
                    MenuItem menuItem = new MenuItem()
                    {
                        Header = suggestion,
                        FontWeight = FontWeights.Bold,
                        Command = EditingCommands.CorrectSpellingError,
                        CommandParameter = suggestion
                    };
                    menuItems.Add(menuItem);
                }

                if (!menuItems.Any())
                {
                    MenuItem noSpellingSuggestions = new MenuItem()
                    {
                        Header = Properties.Resources.NoSpellingSuggestions,
                        FontWeight = FontWeights.Bold,
                        IsEnabled = false,
                    };
                    menuItems.Add(noSpellingSuggestions);
                }

                menuItems.Add(new Separator());

                MenuItem ignoreAllMenuItem = new MenuItem()
                {
                    Header = Properties.Resources.IgnoreAllMenu,
                    Command = EditingCommands.IgnoreSpellingError
                };
                menuItems.Add(ignoreAllMenuItem);

                menuItems.Add(new Separator());
            }

            foreach (Control item in menuItems.Reverse<Control>())
            {
                contextMenu.Items.Insert(0, item);
            }

            dynamicContextMenuItems = menuItems;
        }
Beispiel #30
0
 private void ReadFromFile()
 {
     try {
         var path = Path.Combine(Directory.GetCurrentDirectory(), "History");
         if (Directory.Exists(path)) {
             var str3 = Path.Combine(path, string.Format("{0}.csv", User.Bare));
             if (File.Exists(str3)) {
                 var list = new List<ChatMessage>();
                 var num = 0;
                 using (var reader = new StreamReader(File.Open(str3, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))) {
                     while (!reader.EndOfStream) {
                         var str4 = reader.ReadLine();
                         if ((str4 != null) && (num != 0)) {
                             var strArray = str4.Split(new[] { ';' });
                             var item = new ChatMessage(strArray[0]) {
                                 Date = DateTime.Parse(strArray[1]),
                                 From = strArray[2],
                                 Text = strArray[3].Replace("☺n☺", "\r")
                             };
                             list.Add(item);
                         }
                         num++;
                     }
                 }
                 list.Reverse();
                 foreach (var message3 in list) {
                     Messages.Insert(0, message3);
                 }
             }
         }
     }
     catch (Exception exception) {
         _log.Error(exception);
     }
 }