Exemplo n.º 1
0
        public override bool GetData()
        {
            statusItemList.Clear();

            StatusItemControl statusItemControl = new StatusItemControl();

            Hashtable table = AlgorithmManager.Algorithms.GetExampleDatas();

            if (table != null)
            {
                XmlNode node = table[typeof(ListInsert).ToString()] as XmlElement;

                XmlNodeList childNodes = node.ChildNodes;

                StatusItem statusItem = null;

                foreach (XmlElement el in childNodes)
                {
                    string l = el.Attributes["OriginalString"].Value;
                    int    i = Convert.ToInt32(el.Attributes["InsertPosition"].Value);
                    char   e = Convert.ToChar(el.Attributes["InsertData"].Value);

                    statusItem        = new StatusItem(new ListInsertStatus(l, i, e));
                    statusItem.Height = 80;
                    statusItem.Image  = CreatePreviewImage(l, i, e);
                    statusItemList.Add(statusItem);
                }
            }
            DialogType = typeof(ListInsertDialog);

            InitDataForm form = new InitDataForm();

            form.StatusItemList = statusItemList;

            if (form.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            if (form.SelectedIndex >= 0)             //说明用户是通过选中某个模板来初始化数据的
            {
                StatusItem selectedItem = form.StatusItemList[form.SelectedIndex] as StatusItem;
                if (selectedItem != null)
                {
                    ListInsertStatus tempStatus = selectedItem.ItemInfo as ListInsertStatus;
                    if (tempStatus != null)
                    {
                        l = tempStatus.L;
                        i = tempStatus.I;
                        e = tempStatus.E;
                    }
                }
            }
            else              //说明用户选择自定义数据
            {
                l = status.L;
                i = status.I;
                e = status.E;
            }
            return(true);
        }
Exemplo n.º 2
0
        public override bool GetData()
        {
            statusItemList.Clear();

            StatusItemControl statusItemControl = new StatusItemControl();

            Hashtable table = AlgorithmManager.Algorithms.GetExampleDatas();

            if (table != null)
            {
                XmlNode node = table[typeof(IndexBF).ToString()] as XmlElement;

                XmlNodeList childNodes = node.ChildNodes;

                StatusItem statusItem = null;

                foreach (XmlElement el in childNodes)
                {
                    string s   = el.Attributes["String1"].Value;
                    string t   = el.Attributes["String2"].Value;
                    int    pos = Convert.ToInt32(el.Attributes["StartPosition"].Value);

                    statusItem        = new StatusItem(new IndexBFStatus(s, t, pos));
                    statusItem.Height = 80;
                    statusItem.Image  = CreatePreviewImage(s, t, pos);
                    statusItemList.Add(statusItem);
                }
            }
            DialogType = typeof(IndexBFDialog);

            InitDataForm form = new InitDataForm();

            form.StatusItemList = statusItemList;

            if (form.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            if (form.SelectedIndex >= 0)             //说明用户是通过选中某个模板来初始化数据的
            {
                StatusItem selectedItem = form.StatusItemList[form.SelectedIndex] as StatusItem;
                if (selectedItem != null)
                {
                    IndexBFStatus tempStatus = selectedItem.ItemInfo as IndexBFStatus;
                    if (tempStatus != null)
                    {
                        s   = tempStatus.S;
                        t   = tempStatus.T;
                        pos = tempStatus.Pos;
                    }
                }
            }
            else              //说明用户选择自定义数据
            {
                s   = status.S;
                t   = status.T;
                pos = status.Pos;
            }
            return(true);
        }
Exemplo n.º 3
0
        public override bool GetData()
        {
            statusItemList.Clear();

            StatusItemControl statusItemControl = new StatusItemControl();

            Hashtable table = AlgorithmManager.Algorithms.GetExampleDatas();

            if (table != null)
            {
                XmlNode node = table[typeof(SequenceMerge).ToString()] as XmlElement;

                XmlNodeList childNodes = node.ChildNodes;

                StatusItem statusItem = null;

                foreach (XmlElement el in childNodes)
                {
                    string s1 = el.Attributes["String1"].Value;
                    string s2 = el.Attributes["String2"].Value;

                    statusItem        = new StatusItem(new SequenceMergeStatus(s1, s2));
                    statusItem.Height = 80;
                    statusItem.Image  = CreatePreviewImage(s1, s2);
                    statusItemList.Add(statusItem);
                }
            }

            DialogType = typeof(SequenceMergeDialog);

            InitDataForm form = new InitDataForm();

            form.StatusItemList = statusItemList;

            if (form.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            if (form.SelectedIndex >= 0)             //说明用户是通过选中某个模板来初始化数据的
            {
                StatusItem selectedItem = form.StatusItemList[form.SelectedIndex] as StatusItem;
                if (selectedItem != null)
                {
                    SequenceMergeStatus tempStatus = selectedItem.ItemInfo as SequenceMergeStatus;
                    if (tempStatus != null)
                    {
                        la = tempStatus.La;
                        lb = tempStatus.Lb;
                    }
                }
            }
            else              //说明用户选择自定义数据
            {
                la = status.La;
                lb = status.Lb;
            }
            return(true);
        }
Exemplo n.º 4
0
        public override bool GetData()
        {
            statusItemList.Clear();

            StatusItemControl statusItemControl = new StatusItemControl();

            Hashtable table = AlgorithmManager.Algorithms.GetExampleDatas();

            if (table != null)
            {
                XmlNode node = table[typeof(BinSearch).ToString()] as XmlElement;

                XmlNodeList childNodes = node.ChildNodes;

                StatusItem statusItem = null;

                foreach (XmlElement el in childNodes)
                {
                    string r   = el.Attributes["OriginalString"].Value;
                    char   key = Convert.ToChar(el.Attributes["Key"].Value);

                    statusItem        = new StatusItem(new BinSearchStatus(r, key));
                    statusItem.Height = 80;
                    statusItem.Image  = CreatePreviewImage(r, key);
                    statusItemList.Add(statusItem);
                }
            }
            DialogType = typeof(BinSearchDialog);

            InitDataForm form = new InitDataForm();

            form.StatusItemList = statusItemList;

            if (form.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            if (form.SelectedIndex >= 0)             //说明用户是通过选中某个模板来初始化数据的
            {
                StatusItem selectedItem = form.StatusItemList[form.SelectedIndex] as StatusItem;
                if (selectedItem != null)
                {
                    BinSearchStatus tempStatus = selectedItem.ItemInfo as BinSearchStatus;
                    if (tempStatus != null)
                    {
                        r   = tempStatus.R;
                        key = tempStatus.Key;
                    }
                }
            }
            else              //说明用户选择自定义数据
            {
                r   = status.R;
                key = status.Key;
            }
            return(true);
        }
        public override bool GetData()
        {
            statusItemList.Clear();

            StatusItemControl statusItemControl = new StatusItemControl();

            Hashtable table = AlgorithmManager.Algorithms.GetExampleDatas();

            if (table != null)
            {
                XmlNode node = table[typeof(PreOrderTraverse).ToString()] as XmlElement;

                XmlNodeList childNodes = node.ChildNodes;

                StatusItem statusItem = null;

                foreach (XmlNode el in childNodes)
                {
                    statusItem        = new StatusItem(el);
                    statusItem.Height = 240;
                    statusItem.Image  = CreatePreviewImage(el);
                    statusItemList.Add(statusItem);
                }
            }
            DialogType = typeof(BiTreeDialog);
            InitDataForm form = new InitDataForm();

            form.StatusItemList = statusItemList;

            if (form.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            if (form.SelectedIndex >= 0)             //说明用户是通过选中某个模板来初始化数据的
            {
                StatusItem selectedItem = form.StatusItemList[form.SelectedIndex] as StatusItem;
                if (selectedItem != null)
                {
                    XmlNode tempNode = selectedItem.ItemInfo as XmlNode;
                    if (tempNode != null)
                    {
                        dataNode = tempNode;
                    }
                }
            }
            else              //说明用户选择自定义数据
            {
                //这里不需要输入数据
            }
            return(true);
        }