コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("id,examp")] example example)
        {
            if (id != example.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(example);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!exampleExists(example.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(example));
        }
コード例 #2
0
        public static void CallMe()
        {
            example e = new example();

            Console.WriteLine(e.i);
            see(e);
            Console.WriteLine(e.i);
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            example example = db.examples.Find(id);

            db.examples.Remove(example);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
ファイル: Class1.cs プロジェクト: oujunke/Esprima.Net
        public string testJsNEt()
        {
            var i = new Derivated();
            // i.
            var example = new example();

            example.f12(new object(), new object());
            return(null);
        }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "id,name,dob,address,city,state,ZipCode")] example example)
 {
     if (ModelState.IsValid)
     {
         db.Entry(example).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(example));
 }
コード例 #6
0
        /// <summary>
        /// Write the Example section in the text viewer.
        /// </summary>
        /// <param name="examp"></param>
        /// <returns></returns>
        public static String WriteExample(example examp)
        {
            var exampleStream = "    -------------------------- " + examp.ExampleName + " --------------------------\r\n\r\n";

            exampleStream += "    C:\\PS>" + examp.ExampleCmd + "\r\n\r\n";
            exampleStream += "    " + examp.ExampleDescription + "\r\n\r\n";
            exampleStream += "    " + examp.ExampleOutput + "\r\n\r\n";

            return(exampleStream);
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("id,examp")] example example)
        {
            if (ModelState.IsValid)
            {
                _context.Add(example);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(example));
        }
コード例 #8
0
        public ActionResult Create([Bind(Include = "id,name,dob,address,city,state,ZipCode")] example example)
        {
            if (ModelState.IsValid)
            {
                db.examples.Add(example);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(example));
        }
コード例 #9
0
 void Awack()
 {
     if (instence == null)
     {
         instence = this;
     }
     else
     {
         DestroyImmediate(gameObject);
     }
 }
コード例 #10
0
        // GET: examples/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            example example = db.examples.Find(id);

            if (example == null)
            {
                return(HttpNotFound());
            }
            return(View(example));
        }
コード例 #11
0
    static int Main(string[] args)
    {
        example <int, System.IO.FileStream> ex = new example <int, object>();

        ex.image.filetype = "img/png";
        System.IO.FileStream fs = new System.IO.FileStream("example.png", System.IO.FileMode.Open);
        ex.image = fs.Name.Contains(".png") ? fs : null;
        try{
            System.IO.StreamReader sr = new System.IO.StreamReader(ex.image);
        }
        catch (ArgumentNullException ae) {
            Console.Write(ae.Message + "\nFile:\"" + ex.image.Name + "\" Not Found.\n");
        }
        return(0);
    }
コード例 #12
0
        static void Main(string[] args)
        {
            double a = 12.12, b = 22.22;

            WriteLine($"{a} - {b}");
            example.Sqr(ref a, ref b);
            WriteLine($"{a} - {b}");
            example obj = new example(2);

            WriteLine($"В методе Main: obj.x = {obj.x}\tobj.y = {obj.y}");
            example.Init(obj);
            WriteLine($"В методе Main: obj.x = {obj.x}\tobj.y = {obj.y}");

            WriteLine($"{avarge(12, 15, 16.6)} => () = {avarge()}");
            ReadKey();
        }
コード例 #13
0
        public static void Main()
        {
            example objOfExample = new example();

            objOfExample.print1();
            objOfExample.print2();


            // creating object of interface

            Inumber1 objOfI1 = new example();

            objOfI1.print1();
            Inumber2 objOfI2 = new example();

            objOfI2.print2();
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: Yefancy/Network-Conference
        static void Main(string[] args)
        {
            //对于负责别的模块的开发者来说并不知道IServerCallDatabase里面的实现 可以先引用这个接口
            IServerCallDatabase ex;

            //当别人对这个接口实现后(例如在NCLib实现为example类)就能直接实例使用了
            ex = new example();

            Result result = ex.AddFriend("", "");

            Console.WriteLine(result.BaseResult + result.Info); //任何情况下都能识别基本结果类的结果
            Console.WriteLine((result as exResult).Num);        //在知道自定义结果类型下 查看强制转换后的自定义结果信息

            //输出结果:
            //Faild失败啦
            //23
        }
コード例 #15
0
        /// <summary>
        /// This routine removes examples from the tree.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void DeleteExample_Click(object sender, RoutedEventArgs args)
        {
            if (this.ExamplesControl1.ExampleID.Text == "")
            {
                //Safe to simply reset the Examples page.
                MainWindow.ResetExamplesPage();
            }
            else //We must remove the current record from the Examples list
            {
                TreeViewItem selectedNode = (TreeViewItem)MainWindow.NavControl.CmdletTreeView.SelectedItem;
                TreeViewItem ParentNode   = (TreeViewItem)selectedNode.Parent;
                TreeViewItem CmdletNode   = (TreeViewItem)ParentNode.Parent;
                ParentNode.IsSelected = true;
                //int ItemToRemove = selectedNode.Items.IndexOf();
                //
                cmdletDescription selectedCmdlet  = (cmdletDescription)CmdletNode.DataContext;
                example           selectedExample = (example)selectedNode.DataContext;

                foreach (cmdletDescription mycmdlet in MainWindow.CmdletsHelps)
                {
                    if (mycmdlet.CmdletName == selectedCmdlet.CmdletName)
                    {
                        Collection <example> myExamples = mycmdlet.Examples;
                        example exampletoRemove         = new example();
                        foreach (example myexample in myExamples)
                        {
                            if (myexample.ExampleID == selectedExample.ExampleID)
                            {
                                exampletoRemove = myexample;
                            }
                        }
                        if (exampletoRemove.ExampleID.ToString() != null)
                        {
                            mycmdlet.Examples.Remove(exampletoRemove);
                            ParentNode.Items.Remove(selectedNode);
                        }
                    }
                }
            }
        }
コード例 #16
0
ファイル: DocInfo.cs プロジェクト: dekkerb115/Bam.Net
        internal bool TrySetExample(object item)
        {
            bool    result  = false;
            example example = item as example;

            if (example != null)
            {
                result = true;
                StringBuilder txt = new StringBuilder();
                example.Text.Each(s =>
                {
                    txt.Append(s);
                });
                this.Example = txt.ToString();

                if (example.Items != null)
                {
                    AddItems(example.Items);
                }
            }

            return(result);
        }
コード例 #17
0
ファイル: ArrayTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.array[0].value, "entry one");
コード例 #18
0
 AssertEquals(example.text, "some text");
コード例 #19
0
ファイル: PrologTest.cs プロジェクト: ngallagher/simplexml
 assertTrue(example.flag);
コード例 #20
0
ファイル: PrologTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.text, "entry text");
コード例 #21
0
 AssertEquals(example.one.length, 5);
コード例 #22
0
ファイル: Class1.cs プロジェクト: alfredoaguirre/Esprima.Net
 public string testJsNEt()
 {
     var example = new example();
     example.f12(new object(), new object());
     return null;
 }
コード例 #23
0
ファイル: StrictTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.list[0].value, "value 1");
コード例 #24
0
ファイル: CaseTest.cs プロジェクト: restlet/simplexml
 validate(example, persister);
コード例 #25
0
 AssertNotNull(example.stringMap);
コード例 #26
0
 static public void Init(example a)
 {
     a.x = a.y = 1;
 }
コード例 #27
0
ファイル: UnicodeTest.cs プロジェクト: ngallagher/simplexml
 AssertUnicode(example);
コード例 #28
0
 AssertNotNull(example.stringArray);
コード例 #29
0
ファイル: ListCycleTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.one.size(), 5);
コード例 #30
0
        /// <summary>
        /// This is the static method which Asim helped me with.
        /// I get all the Cmdlet Mamal info from here.
        /// I need to pass the cmdletDescription record before adding it to the CmdletHelps collection.
        ///
        /// </summary>
        public static cmdletDescription GetExistingHelpInfo(cmdletDescription CmdletHelp, String CmdletName, String path)
        {
            //String path1 = @"C:\Windows\System32\WindowsPowerShell\v1.0\en-US\Microsoft.PowerShell.Commands.Management.dll-Help.xml";
            XmlDocument doc = new XmlDocument();

            doc.Load(path);

            XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);

            ns.AddNamespace("", "http://msh");
            ns.AddNamespace("command", "http://schemas.microsoft.com/maml/dev/command/2004/10");
            ns.AddNamespace("maml", "http://schemas.microsoft.com/maml/2004/10");
            ns.AddNamespace("dev", "http://schemas.microsoft.com/maml/dev/2004/10");
            XmlNodeList commandNodes = doc.SelectNodes("//command:command", ns);

            foreach (XmlNode commandNode in commandNodes)
            {
                XmlNode nameNode = commandNode.SelectSingleNode("command:details/command:name", ns);
                if (nameNode.InnerText.Trim().ToLower() == CmdletName.ToLower())
                {
                    // MessageBox.Show(commandNode.OuterXml);
                    XmlNode tempNode = null;

                    tempNode = commandNode.SelectSingleNode("command:details/maml:description", ns);
                    if (tempNode != null)
                    {
                        CmdletHelp.OldShortDescription = CmdletHelp.ShortDescription = tempNode.InnerText.Trim();
                    }

                    tempNode = commandNode.SelectSingleNode("maml:description", ns);
                    if (tempNode != null)
                    {
                        CmdletHelp.OldLongDescription = CmdletHelp.LongDescription = tempNode.InnerText.Trim();
                    }

                    tempNode = commandNode.SelectSingleNode("command:inputTypes/command:inputType/dev:type/maml:name", ns);
                    if (tempNode != null)
                    {
                        CmdletHelp.OldInputType = CmdletHelp.InputType = tempNode.InnerText.Trim();
                    }

                    tempNode = commandNode.SelectSingleNode("command:inputTypes/command:inputType/dev:type/maml:description", ns);
                    if (tempNode != null)
                    {
                        CmdletHelp.OldInputDesc = CmdletHelp.InputDesc = tempNode.InnerText.Trim();
                    }

                    tempNode = commandNode.SelectSingleNode("command:returnValues/command:returnValue/dev:type/maml:name", ns);
                    if (tempNode != null)
                    {
                        CmdletHelp.OldOutputType = CmdletHelp.OutputType = tempNode.InnerText.Trim();
                    }

                    tempNode = commandNode.SelectSingleNode("command:returnValues/command:returnValue/dev:type/maml:description", ns);
                    if (tempNode != null)
                    {
                        CmdletHelp.OldOutputDesc = CmdletHelp.OutputDesc = tempNode.InnerText.Trim();
                    }

                    tempNode = commandNode.SelectSingleNode("maml:alertSet/maml:alert", ns);
                    if (tempNode != null)
                    {
                        CmdletHelp.OldNote = CmdletHelp.Note = tempNode.InnerText.Trim();
                    }

                    XmlNodeList exampleNodes = commandNode.SelectNodes("command:examples/command:example", ns);

                    int exampleCount = 0;
                    Collection <example> CmdletExamples = new Collection <example>();
                    foreach (XmlNode exampleNode in exampleNodes)
                    {
                        example CmdletExample = new example();

                        tempNode = exampleNode.SelectSingleNode("maml:title", ns);
                        if (tempNode != null)
                        {
                            CmdletExample.OldExampleName = CmdletExample.ExampleName = tempNode.InnerText.Trim().Replace("-", "");
                            if (CmdletExample.ExampleName.Length == 0 || CmdletExample.ExampleName.Replace(" ", "") == "")
                            {
                                CmdletExample.ExampleName = CmdletExample.OldExampleName = "Unkown";
                            }
                        }

                        CmdletExample.ExampleID = exampleCount;

                        tempNode = exampleNode.SelectSingleNode("dev:code", ns);
                        if (tempNode != null)
                        {
                            CmdletExample.OldExampleCmd = CmdletExample.ExampleCmd = tempNode.InnerText.Trim();
                        }

                        tempNode = exampleNode.SelectSingleNode("dev:remarks", ns);
                        if (tempNode != null)
                        {
                            int NodeCount = 0;
                            foreach (XmlNode DescriptionNode in tempNode)
                            {
                                if (NodeCount == 0)
                                {
                                    CmdletExample.OldExampleDescription = CmdletExample.ExampleDescription = DescriptionNode.InnerText.Trim();
                                }
                                else
                                {
                                    CmdletExample.OldExampleOutput += DescriptionNode.InnerText.Trim();
                                    CmdletExample.ExampleOutput     = CmdletExample.OldExampleOutput;
                                }
                                NodeCount++;
                            }
                        }

                        tempNode = exampleNode.SelectSingleNode("command:commandLines", ns);
                        if (tempNode != null)
                        {
                            CmdletExample.OldExampleOutput += tempNode.InnerText.Trim();
                            CmdletExample.ExampleOutput     = CmdletExample.OldExampleOutput;
                        }

                        exampleCount++;

                        CmdletExamples.Add(CmdletExample);
                    }

                    CmdletHelp.Examples = CmdletExamples;

                    Collection <relatedlink> RelatedLinks = new Collection <relatedlink>();
                    XmlNodeList NodeLinks = commandNode.SelectNodes("maml:relatedLinks/maml:navigationLink", ns);
                    int         LinkCount = 0;
                    foreach (XmlNode linkNode in NodeLinks)
                    {
                        relatedlink RelatedLink = new relatedlink();

                        tempNode = linkNode.SelectSingleNode("maml:linkText", ns);
                        if (tempNode != null)
                        {
                            RelatedLink.OldLinkText = RelatedLink.LinkText = tempNode.InnerText.Trim();
                            if (RelatedLink.LinkText.Length == 0)
                            {
                                RelatedLink.LinkText = RelatedLink.LinkText = "Unkown";
                            }
                        }

                        RelatedLink.LinkID = LinkCount;

                        LinkCount++;

                        RelatedLinks.Add(RelatedLink);
                    }
                    CmdletHelp.RelatedLinks = RelatedLinks;


                    //iterate through parameters
                    XmlNodeList parameterNodes = commandNode.SelectNodes("command:parameters/command:parameter", ns);
                    if (CmdletHelp.ParameterDecription != null)
                    {
                        foreach (parameterDecription CmdletParameter in CmdletHelp.ParameterDecription)
                        {
                            //maml:description
                            foreach (XmlNode parameterNode in parameterNodes)
                            {
                                tempNode = parameterNode.SelectSingleNode("maml:name", ns);
                                if (tempNode != null)
                                {
                                    if (CmdletParameter.Name.ToLower() == tempNode.InnerText.Trim().ToLower())
                                    {
                                        tempNode = parameterNode.SelectSingleNode("maml:description", ns);
                                        if (tempNode != null)
                                        {
                                            CmdletParameter.OldDescription = CmdletParameter.NewDescription = tempNode.InnerText.Trim();
                                        }

                                        tempNode = parameterNode.SelectSingleNode("dev:defaultValue", ns);
                                        if (tempNode != null)
                                        {
                                            CmdletParameter.DefaultValue = CmdletParameter.OldDefaultValue = tempNode.InnerText.Trim();
                                        }

                                        tempNode = parameterNode.SelectSingleNode("@globbing", ns);

                                        if (tempNode.Value.ToLower().Trim() == "true")
                                        {
                                            CmdletParameter.Globbing = CmdletParameter.OldGlobbing = true;
                                        }
                                        else
                                        {
                                            CmdletParameter.Globbing = CmdletParameter.OldGlobbing = false;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    //I do not have code parameters. Get only help ones and mark them in red.

                    foreach (XmlNode parameterNode in parameterNodes)
                    {
                        Boolean ParameterFound = false;
                        tempNode = parameterNode.SelectSingleNode("maml:name", ns);
                        String ParameterName = tempNode.InnerText.Trim();
                        if (CmdletHelp.ParameterDecription != null)
                        {
                            foreach (parameterDecription CmdletParameter in CmdletHelp.ParameterDecription)
                            {
                                if (CmdletParameter.Name.ToLower() == ParameterName.ToLower())
                                {
                                    ParameterFound = true;
                                    break;
                                }
                            }
                        }
                        if (ParameterFound == false)
                        {
                            //Get help parameter.
                            parameterDecription CmdletParameter = new parameterDecription();
                            CmdletParameter.HelpOnlyParameter = true;
                            MainWindow.ObsoleteInfo           = true;
                            tempNode = parameterNode.SelectSingleNode("maml:name", ns);
                            if (tempNode != null)
                            {
                                //  if (CmdletParameter.Name.ToLower() == tempNode.InnerText.Trim().ToLower())
                                // {
                                tempNode = parameterNode.SelectSingleNode("maml:description", ns);
                                if (tempNode != null)
                                {
                                    CmdletParameter.OldDescription = CmdletParameter.NewDescription = tempNode.InnerText.Trim();
                                }

                                tempNode = parameterNode.SelectSingleNode("dev:defaultValue", ns);
                                if (tempNode != null)
                                {
                                    CmdletParameter.DefaultValue = CmdletParameter.OldDefaultValue = tempNode.InnerText.Trim();
                                }

                                tempNode = parameterNode.SelectSingleNode("@globbing", ns);

                                if (tempNode.Value.ToLower().Trim() == "true")
                                {
                                    CmdletParameter.Globbing = CmdletParameter.OldGlobbing = true;
                                }
                                else
                                {
                                    CmdletParameter.Globbing = CmdletParameter.OldGlobbing = false;
                                }
                                tempNode = parameterNode.SelectSingleNode("@pipelineInput", ns);

                                if (tempNode != null)
                                {
                                    if (tempNode.Value.ToLower().Trim() == "true (ByPropertyName)")
                                    {
                                        CmdletParameter.VFPBPN = CmdletParameter.VFPBPN = true;
                                    }
                                    else if (tempNode.Value.ToLower().Trim() == "true (ByValue, ByPropertyName)")
                                    {
                                        CmdletParameter.VFPBPN = CmdletParameter.VFPBPN = true;
                                        CmdletParameter.VFP    = CmdletParameter.VFP = true;
                                    }
                                    else if (tempNode.Value.ToLower().Trim() == "true (ByValue)")
                                    {
                                        CmdletParameter.VFP = CmdletParameter.VFP = true;
                                    }
                                    else
                                    {
                                        CmdletParameter.VFPBPN = CmdletParameter.VFPBPN = false;
                                        CmdletParameter.VFP    = CmdletParameter.VFP = false;
                                    }
                                }
                                tempNode = parameterNode.SelectSingleNode("@position", ns);

                                if (tempNode != null)
                                {
                                    CmdletParameter.Position = tempNode.Value.ToLower().Trim();
                                }

                                tempNode = parameterNode.SelectSingleNode("@required", ns);
                                if (tempNode != null)
                                {
                                    if (tempNode.Value.ToLower().Trim() == "true")
                                    {
                                        CmdletParameter.isMandatory = true;
                                    }
                                }
                                tempNode = parameterNode.SelectSingleNode("dev:type/maml:name", ns);
                                if (tempNode != null)
                                {
                                    if (tempNode.InnerText != null)
                                    {
                                        CmdletParameter.ParameterType = tempNode.InnerText.Trim().ToLower();
                                    }
                                }

                                CmdletParameter.Name       = ParameterName;
                                CmdletParameter.CmdletName = CmdletName;
                                if (CmdletHelp.ParameterDecription == null)
                                {
                                    CmdletHelp.ParameterDecription = new Collection <parameterDecription>();
                                }
                                CmdletHelp.ParameterDecription.Add(CmdletParameter);
                            }
                        }
                    }

                    // break;
                }
            }
            return(CmdletHelp);
        }
コード例 #31
0
 }To create a new message type create a sub-class of the MessageRouter's Message class. A message can contain any additional data that is specific to this new message type. It can also contain any additional convenience constructors and methods that you deem necessary. In this example I've kept things simple and have only added a single attribute with the call-sign of the pilot that has sent this distress message. 
コード例 #32
0
ファイル: StyleTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.URL, "http://domain.com/");
コード例 #33
0
ファイル: CaseTest.cs プロジェクト: ngallagher/simplexml
 validate(example, persister);
コード例 #34
0
 public static void see(example e1)
 {
     e1.i = 10;
     e1   = null;
 }
コード例 #35
0
 AssertEquals(example.one[0].value, "entry one");
コード例 #36
0
ファイル: PrologTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.id, 12);
コード例 #37
0
 Validate(example, serializer);
コード例 #38
0
ファイル: PrologTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.name, "some name");
コード例 #39
0
 AssertNotNull(example.stringList);
コード例 #40
0
 example()
 {
     value = new T();
     image = new example <T, I> .buffer();
 }
コード例 #41
0
 WeightedRandomizer.From(weights).TakeOne(); For this example to work we assume that weights is a Dictionary that contains the spawn rates.Example:
コード例 #42
0
ファイル: ArrayTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.array.length, 5);
コード例 #43
0
 AssertEquals(example.b.c, "c");
コード例 #44
0
 AssertEquals(example.name, "test");
コード例 #45
0
ファイル: RootTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.text, "Some text example");
コード例 #46
0
        /// <summary>
        /// This routine handles the Save button on the Examples page
        /// It adds the new record to the tree.
        /// If this is already in the tree it updates it with the latest
        /// info in the page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void AddExample_Click(object sender, RoutedEventArgs args)
        {
            TreeViewItem SelectedNode = (TreeViewItem)MainWindow.NavControl.CmdletTreeView.SelectedItem;

            if (SelectedNode != null)
            {
                int count = SelectedNode.Items.Count;
                if (this.ExamplesControl1.ExampleNameTextBox.Text == "")
                {
                    this.ExamplesControl1.ExampleNameTextBox.Text = "Example " + (count + 1).ToString();
                }

                if (this.ExamplesControl1.ExampleID.Text == "")
                //This is a new example
                {
                    //Add new exampe info.
                    TreeViewItem ParentNode = new TreeViewItem();
                    if ((String)SelectedNode.Header == "Examples")
                    {
                        ParentNode = (TreeViewItem)SelectedNode.Parent;
                    }
                    else
                    {
                        ParentNode = (TreeViewItem)SelectedNode.Parent;
                        ParentNode = (TreeViewItem)ParentNode.Parent;
                    }

                    cmdletDescription Cmdletdesc  = (cmdletDescription)ParentNode.DataContext;
                    example           examDetails = new example();
                    examDetails.ExampleCmd         = this.ExamplesControl1.ExampleCommandTextBox.Text;
                    examDetails.ExampleDescription = this.ExamplesControl1.ExampleDescriptionTextBox.Text;
                    examDetails.ExampleName        = this.ExamplesControl1.ExampleNameTextBox.Text;
                    examDetails.ExampleOutput      = this.ExamplesControl1.ExampleOutputTextBox.Text;
                    examDetails.ExampleID          = count;
                    TreeViewItem NewExampleNode = new TreeViewItem();
                    NewExampleNode.DataContext = examDetails;
                    NewExampleNode.Header      = examDetails.ExampleName;
                    if (Cmdletdesc.Examples == null)
                    {
                        Collection <example> Examples = new Collection <example>();
                        Examples.Add(examDetails);
                        Cmdletdesc.Examples      = Examples;
                        SelectedNode.DataContext = Examples;
                    }
                    else
                    {
                        Cmdletdesc.Examples.Add(examDetails);
                    }
                    MainWindow.ResetExamplesPage();
                    if ((String)SelectedNode.Header == "Examples")
                    {
                        if (sender != null)
                        {
                            SelectedNode.Items.Add(NewExampleNode);
                            SelectedNode.IsExpanded = true;
                            //int count = SelectedNode.Items.Count;
                            TreeViewItem ChildNode = (TreeViewItem)SelectedNode.Items[count];
                            ChildNode.IsSelected = true;
                        }
                        else
                        {
                            SelectedNode.Items.Add(NewExampleNode);
                            SelectedNode.IsExpanded = true;
                        }
                    }
                }


                else //this is an existing example
                {
                    //Update Example info.
                    if (SelectedNode.Header.ToString() == "Examples")
                    {
                        Collection <example> examDetails = (Collection <example>)SelectedNode.DataContext;
                        example examDetail = new example();
                        examDetail.ExampleCmd         = this.ExamplesControl1.ExampleCommandTextBox.Text;
                        examDetail.ExampleDescription = this.ExamplesControl1.ExampleDescriptionTextBox.Text;
                        examDetail.ExampleName        = this.ExamplesControl1.ExampleNameTextBox.Text;
                        examDetail.ExampleOutput      = this.ExamplesControl1.ExampleOutputTextBox.Text;
                        examDetails.Add(examDetail);
                        //SelectedNode.Header = this.ExampleNameTextBox.Text;
                    }
                    else
                    {
                        example examDetails = (example)SelectedNode.DataContext;
                        examDetails.ExampleCmd         = this.ExamplesControl1.ExampleCommandTextBox.Text;
                        examDetails.ExampleDescription = this.ExamplesControl1.ExampleDescriptionTextBox.Text;
                        examDetails.ExampleName        = this.ExamplesControl1.ExampleNameTextBox.Text;
                        examDetails.ExampleOutput      = this.ExamplesControl1.ExampleOutputTextBox.Text;
                        SelectedNode.Header            = this.ExamplesControl1.ExampleNameTextBox.Text;
                    }
                }
            }
        }
コード例 #47
0
ファイル: StyleTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.name, "example");
コード例 #48
0
ファイル: runme.cs プロジェクト: Art-robot0/ros_voice
    public static void Main()
    {
        // Try to set the values of some global variables

        example.ivar    = 42;
        example.svar    = -31000;
        example.lvar    = 65537;
        example.uivar   = 123456;
        example.usvar   = 61000;
        example.ulvar   = 654321;
        example.scvar   = -13;
        example.ucvar   = 251;
        example.cvar    = 'S';
        example.fvar    = (float)3.14159;
        example.dvar    = 2.1828;
        example.strvar  = "Hello World";
        example.iptrvar = example.new_int(37);
        example.ptptr   = example.new_Point(37, 42);
        example.name    = "Bill";

        // Now print out the values of the variables

        Console.WriteLine("Variables (values printed from C#)");

        Console.WriteLine("ivar      =" + example.ivar);
        Console.WriteLine("svar      =" + example.svar);
        Console.WriteLine("lvar      =" + example.lvar);
        Console.WriteLine("uivar     =" + example.uivar);
        Console.WriteLine("usvar     =" + example.usvar);
        Console.WriteLine("ulvar     =" + example.ulvar);
        Console.WriteLine("scvar     =" + example.scvar);
        Console.WriteLine("ucvar     =" + example.ucvar);
        Console.WriteLine("fvar      =" + example.fvar);
        Console.WriteLine("dvar      =" + example.dvar);
        Console.WriteLine("cvar      =" + example.cvar);
        Console.WriteLine("strvar    =" + example.strvar);
        Console.WriteLine("cstrvar   =" + example.cstrvar);
        Console.WriteLine("iptrvar   =" + example.iptrvar);
        Console.WriteLine("name      =" + example.name);
        Console.WriteLine("ptptr     =" + example.ptptr + example.Point_print(example.ptptr));
        Console.WriteLine("pt        =" + example.pt + example.Point_print(example.pt));

        Console.WriteLine("\nVariables (values printed from C)");

        example.print_vars();

        Console.WriteLine("\nNow I'm going to try and modify some read only variables");
        Console.WriteLine("\nChecking that the read only variables are readonly...");

        example ex = new example();
        Type    t  = ex.GetType();

        Console.WriteLine("     'path'");
        PropertyInfo pi = t.GetProperty("path");

        if (pi.CanWrite)
        {
            Console.WriteLine("Oh dear this variable is not read only\n");
        }
        else
        {
            Console.WriteLine("Good.");
        }

        Console.WriteLine("     'status'");
        pi = t.GetProperty("status");
        if (pi.CanWrite)
        {
            Console.WriteLine("Oh dear this variable is not read only");
        }
        else
        {
            Console.WriteLine("Good.");
        }

        Console.WriteLine("\nI'm going to try and update a structure variable.\n");

        example.pt = example.ptptr;

        Console.WriteLine("The new value is");
        example.pt_print();
        Console.WriteLine("You should see the value" + example.Point_print(example.ptptr));
    }
コード例 #49
0
ファイル: StrictTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.list.length, 3);
コード例 #50
0
        private TemplateDefinition CreateTemplateDefinition(Template template)
        {
            var friendlyName = template.Name.Replace("'", "_").Replace(" ", "_");
            TemplateDefinition templateDef = new TemplateDefinition();

            templateDef.context      = new context();
            templateDef.context.path = template.PrimaryContext;
            templateDef.name         = friendlyName.Length > 80 ? friendlyName.Substring(0, 80) : friendlyName;
            templateDef.isClosed     = !template.IsOpen;
            templateDef.id           = template.Oid;

            // Get the actual identifier
            if (template.IsIdentifierOID())
            {
                string oid;
                template.GetIdentifierOID(out oid);
                templateDef.id = oid;
            }
            else if (template.IsIdentifierII())
            {
                string   oid, ext;
                DateTime extDate;
                template.GetIdentifierII(out oid, out ext);
                templateDef.id           = oid;
                templateDef.versionLabel = ext;

                if (DateTime.TryParse(ext, out extDate))
                {
                    templateDef.effectiveDate          = extDate;
                    templateDef.effectiveDateSpecified = true;
                }
            }

            // template type
            TemplateProperties property = new TemplateProperties();

            templateDef.classification = new TemplateProperties[] { property };

            if (template.PrimaryContextType.ToLower() == "clinicaldocument")
            {
                property.type = TemplateTypes.cdaheaderlevel;
            }
            else if (template.PrimaryContextType.ToLower() == "section")
            {
                property.type = TemplateTypes.cdasectionlevel;
            }
            else
            {
                property.type = TemplateTypes.cdaentrylevel;
            }

            // release date based on implementation guide's publish date
            if (template.OwningImplementationGuide.IsPublished())
            {
                if (template.OwningImplementationGuide.PublishDate != null)
                {
                    templateDef.officialReleaseDate          = template.OwningImplementationGuide.PublishDate.Value;
                    templateDef.officialReleaseDateSpecified = true;
                }
            }

            // Status
            if (template.Status == this.publishedStatus)
            {
                templateDef.statusCode = TemplateStatusCodeLifeCycle.active;
            }
            else if (template.Status == this.retiredStatus)
            {
                templateDef.statusCode = TemplateStatusCodeLifeCycle.retired;
            }
            else
            {
                templateDef.statusCode = TemplateStatusCodeLifeCycle.draft;
            }

            // description
            if (!string.IsNullOrEmpty(template.Description))
            {
                XmlNode[] anyField = new XmlNode[] { dom.CreateTextNode(template.Description) };

                templateDef.desc = new FreeFormMarkupWithLanguage[] {
                    new FreeFormMarkupWithLanguage()
                    {
                        Any = anyField
                    }
                };
            }

            // samples/examples
            List <example> examples = new List <example>();

            foreach (var sample in template.TemplateSamples)
            {
                example   templateExample = new example();
                XmlNode[] anyField        = new XmlNode[] { dom.CreateTextNode(sample.XmlSample) };

                templateExample.Any = anyField;
                examples.Add(templateExample);
            }

            if (examples.Count > 0)
            {
                templateDef.example = examples.ToArray();
            }

            // constraints
            ConstraintExporter constraintExporter = new ConstraintExporter(dom, template, igSettings, this.tdb);

            templateDef.Items = constraintExporter.ExportConstraints();

            return(templateDef);
        }
コード例 #51
0
ファイル: TemplateTest.cs プロジェクト: ngallagher/simplexml
 Validate(example, serializer);
コード例 #52
0
 AssertEquals(example.b.d.e, "e");
コード例 #53
0
ファイル: StyleTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.version, 1.0f);
コード例 #54
0
 AssertEquals(example.attribute[0], "one");
コード例 #55
0
ファイル: UnicodeTest.cs プロジェクト: restlet/simplexml
 Validate(example, persister); // Ensure the deserialized object is valid
コード例 #56
0
ファイル: runme.cs プロジェクト: FeepingCreature/swig
  public static void Main() {

    // Try to set the values of some global variables

    example.ivar   =  42;
    example.svar   = -31000;
    example.lvar   =  65537;
    example.uivar  =  123456;
    example.usvar  =  61000;
    example.ulvar  =  654321;
    example.scvar  =  -13;
    example.ucvar  =  251;
    example.cvar   =  'S';
    example.fvar   =  (float)3.14159;
    example.dvar   =  2.1828;
    example.strvar =  "Hello World";
    example.iptrvar= example.new_int(37);
    example.ptptr  = example.new_Point(37,42);
    example.name   = "Bill";

    // Now print out the values of the variables

    Console.WriteLine( "Variables (values printed from C#)" );

    Console.WriteLine( "ivar      =" + example.ivar );
    Console.WriteLine( "svar      =" + example.svar );
    Console.WriteLine( "lvar      =" + example.lvar );
    Console.WriteLine( "uivar     =" + example.uivar );
    Console.WriteLine( "usvar     =" + example.usvar );
    Console.WriteLine( "ulvar     =" + example.ulvar );
    Console.WriteLine( "scvar     =" + example.scvar );
    Console.WriteLine( "ucvar     =" + example.ucvar );
    Console.WriteLine( "fvar      =" + example.fvar );
    Console.WriteLine( "dvar      =" + example.dvar );
    Console.WriteLine( "cvar      =" + example.cvar );
    Console.WriteLine( "strvar    =" + example.strvar );
    Console.WriteLine( "cstrvar   =" + example.cstrvar );
    Console.WriteLine( "iptrvar   =" + example.iptrvar );
    Console.WriteLine( "name      =" + example.name );
    Console.WriteLine( "ptptr     =" + example.ptptr + example.Point_print(example.ptptr) );
    Console.WriteLine( "pt        =" + example.pt + example.Point_print(example.pt) );

    Console.WriteLine( "\nVariables (values printed from C)" );

    example.print_vars();

    Console.WriteLine( "\nNow I'm going to try and modify some read only variables" );
    Console.WriteLine( "\nChecking that the read only variables are readonly..." );

    example ex = new example();
    Type t = ex.GetType();

    Console.WriteLine( "     'path'" );
    PropertyInfo pi = t.GetProperty("path");
    if (pi.CanWrite)
      Console.WriteLine("Oh dear this variable is not read only\n");
    else
      Console.WriteLine("Good.");

    Console.WriteLine( "     'status'" );
    pi = t.GetProperty("status");
    if (pi.CanWrite)
      Console.WriteLine("Oh dear this variable is not read only");
    else
      Console.WriteLine("Good.");

    Console.WriteLine( "\nI'm going to try and update a structure variable.\n" );

    example.pt = example.ptptr;

    Console.WriteLine( "The new value is" );
    example.pt_print();
    Console.WriteLine( "You should see the value" + example.Point_print(example.ptptr) );
  }
コード例 #57
0
ファイル: TemplateTest.cs プロジェクト: ngallagher/simplexml
 AssertEquals(example.details.name, "Niall Gallagher");