コード例 #1
0
        public async Task <IActionResult> Edit(decimal id, [Bind("ID,LASTNAME,FIRSTNAME,GENDER")] SampleName sampleName)
        {
            if (id != sampleName.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sampleName);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SampleNameExists(sampleName.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sampleName));
        }
コード例 #2
0
        void RenderSelectedSample()
        {
            SampleName sampleName = (SampleName)listBox1.SelectedItem;

            using (Graphics g = this.panel1.CreateGraphics())
                using (Bitmap bmp1 = new Bitmap(400, 500))
                    using (var bmplock = bmp1.Lock())
                    {
                        WriteableBitmap wb = bmplock.GetWritableBitmap();
                        switch (sampleName)
                        {
                        case SampleName.StaticShapes:
                            DrawStaticShapes(wb);
                            break;

                        case SampleName.DrawShapes:
                            DrawShapes(wb);
                            break;

                        case SampleName.DrawFillDemo:
                            DrawFillDemo(wb);
                            break;
                        }

                        bmplock.WriteAndUnlock();
                        //

                        g.Clear(System.Drawing.Color.White);
                        g.DrawImage(bmp1, 0, 0);
                    }
        }
コード例 #3
0
        void RenderSelectedSample()
        {
            SampleName sampleName = (SampleName)listBox1.SelectedItem;

            //render!
            using (Graphics g = this.panel1.CreateGraphics())
                using (Bitmap bmp1 = new Bitmap(400, 500))
                    using (LockBmp bmplock = bmp1.Lock())
                    {
                        BitmapBuffer wb = bmplock.CreateNewBitmapBuffer();
                        switch (sampleName)
                        {
                        case SampleName.DrawEllipses:
                            DrawEllipses(wb);
                            break;

                        case SampleName.DrawEllipsesFlower:
                            DrawEllipsesFlower(wb);
                            break;

                        case SampleName.DrawStaticShapes:
                            DrawStaticShapes(wb);
                            break;
                        }

                        bmplock.WriteAndUnlock();
                        //

                        g.Clear(System.Drawing.Color.White);
                        g.DrawImage(bmp1, 0, 0);
                    }
        }
コード例 #4
0
        protected int CompareTo(MsDataFilePath other)
        {
            // Culture specific sorting desirable in file paths
// ReSharper disable StringCompareToIsCultureSpecific
            int result = FilePath.CompareTo(other.FilePath);

            if (result != 0)
            {
                return(result);
            }
            result = SampleName.CompareTo(other.SampleName);
            if (result != 0)
            {
                return(result);
            }
            result = SampleIndex.CompareTo(other.SampleIndex);
            if (result != 0)
            {
                return(result);
            }
            result = CentroidMs1.CompareTo(other.CentroidMs1);
            if (result != 0)
            {
                return(result);
            }
            result = CentroidMs2.CompareTo(other.CentroidMs2);
            if (result != 0)
            {
                return(result);
            }
            return(LockMassParameters.CompareTo(other.LockMassParameters));
// ReSharper restore StringCompareToIsCultureSpecific
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("ID,LASTNAME,FIRSTNAME,GENDER")] SampleName sampleName)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sampleName);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sampleName));
        }
コード例 #6
0
 private void UpdateItem()
 {
     SelectedItem.ProductCode = IsSample ? SampleName.Trim() : SelectedInput.Code;
     SelectedItem.UnitPrice   = SelectedItem.IsSample ? Convert.ToDouble(SamplePriceText) : SelectedInput.Price;
     SelectedItem.ShipQty     = this.InputQty;
     SelectedItem.ShipDate    = this.InputDate;
     SelectedItem.ColorCode   = SelectedColor == null ? string.Empty : SelectedColor.item.Code;
     SelectedItem.ColorName   = SelectedColor == null ? string.Empty : SelectedColor.item.Name;
     ShipmentDao.Update(SelectedItem);
     ClearInput();
 }
コード例 #7
0
        /// <summary>
        /// Demonstrates various rendering capabilities.
        /// </summary>
        /// <param name="invocationContext"></param>
        /// <param name="sample">&lt;colors|dir&gt; Renders a specified sample</param>
        /// <param name="height">The height of the rendering area</param>
        /// <param name="width">The width of the rendering area</param>
        /// <param name="top">The top position of the render area</param>
        /// <param name="left">The left position of the render area</param>
        /// <param name="text">The text to render</param>
        /// <param name="overwrite">Overwrite the specified region. (If not, scroll.)</param>
        public static void Main(
#pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
            InvocationContext invocationContext,
            SampleName sample = SampleName.Dir,
            int?height        = null,
            int?width         = null,
            int top           = 0,
            int left          = 0,
            string text       = null,
            bool overwrite    = true)
#pragma warning restore CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
        {
        }
コード例 #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = FilePath.GetHashCode();
         hashCode = (hashCode * 397) ^ (SampleName != null ? SampleName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ SampleIndex;
         hashCode = (hashCode * 397) ^ (LockMassParameters != null ? LockMassParameters.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CentroidMs1 ? 1 : 0);
         hashCode = (hashCode * 397) ^ (CentroidMs2 ? 1 : 0);
         return(hashCode);
     }
 }
コード例 #9
0
 private string SampleNameInputValidate(string str)
 {
     try
     {
         Model.SampleName.Value = SampleName.Create(str);
         return null;
     }
     catch (Exception ex)
     {
         Model.SampleName.Value = SampleName.NullObject;
         return ex.Message;
     }
 }
コード例 #10
0
 private string sampleNameValidate(string str)
 {
     try
     {
         Model.SampleName.Value = SampleName.Create(str);
         return(null);
     }
     catch (Exception ex)
     {
         Model.SampleName.Value = SampleName.NullObject;
         return(ex.Message);
     }
 }
コード例 #11
0
        private void CreateItem()
        {
            ShipmentItemModel item = new ShipmentItemModel()
            {
                CustomerCode = this._customerType,
                ProductCode  = IsSample ? SampleName.Trim() : SelectedInput.Code,
                UnitPrice    = IsSample ? Convert.ToDouble(SamplePriceText) : SelectedInput.Price,
                ShipQty      = this.InputQty,
                ShipDate     = this.InputDate,
                ColorCode    = SelectedColor == null ? string.Empty : SelectedColor.item.Code,
                ColorName    = SelectedColor == null ? string.Empty : SelectedColor.item.Name,
                IsSample     = this.IsSample
            };
            long id = ShipmentDao.Create(item);

            item.SerialNumber = id;
            this._listModel.Add(item);
            ClearInput();
        }
コード例 #12
0
ファイル: Genotype.cs プロジェクト: smith-chem-wisc/Bio.VCF
 /// <summary>
 /// comparable genotypes -> compareTo on the sample names </summary>
 /// <param name="genotype">
 /// @return </param>
 public virtual int CompareTo(Genotype genotype)
 {
     return(SampleName.CompareTo(genotype.SampleName));
 }
コード例 #13
0
 /// <summary>
 /// Creates a new database from a restore point.
 /// </summary>
 /// <param name="sampleName">The sample database to use as the source.</param>
 /// <return>The next stage of the definition.</return>
 SqlDatabase.Definition.IWithAttachAfterElasticPoolOptions <SqlElasticPoolOperations.Definition.IWithCreate> SqlDatabase.Definition.IWithSampleDatabaseAfterElasticPoolBeta <SqlElasticPoolOperations.Definition.IWithCreate> .FromSample(SampleName sampleName)
 {
     return(this.FromSample(sampleName) as SqlDatabase.Definition.IWithAttachAfterElasticPoolOptions <SqlElasticPoolOperations.Definition.IWithCreate>);
 }
コード例 #14
0
 public MessageBrokerViewModel(IEventAggregator eventAggregator)
 {
     MessageBrokerCommand.Subscribe(_ => Reactive.Bindings.Notifiers.MessageBroker.Default.Publish <SampleNameChange>(new SampleNameChange(SampleName.Create(MessageBrokerName.Value), ViewName.Create("MessageBrokerView")))).AddTo(DisposeCollection);
     PubSubEventCommand.Subscribe(_ => eventAggregator.GetEvent <SampleNameChangeEvent>().Publish(new SampleNameChange(SampleName.Create(MessageBrokerName.Value), ViewName.Create("MessageBrokerView")))).AddTo(DisposeCollection);
 }
コード例 #15
0
 ///GENMHASH:E181EA037CDEB6D9DCE12CA92D1526C7:EB79EBAE731A72F314AF4FA5FF21E806
 public SqlDatabaseForElasticPoolImpl FromSample(SampleName sampleName)
 {
     this.sqlDatabase.FromSample(sampleName);
     return(this);
 }
コード例 #16
0
 ///GENMHASH:E181EA037CDEB6D9DCE12CA92D1526C7:0D2A486B784948E9672C737F8A7624D2
 public SqlDatabaseImpl FromSample(SampleName sampleName)
 {
     this.Inner.SampleName = sampleName.Value;
     return(this);
 }
コード例 #17
0
 protected override string Build() => $"{PatientId.Build()}{OrderId.Build()}" +
                                      $"{OrderInformation.Build()}{SampleName.Build()}" +
                                      $"{GetTests()}";
コード例 #18
0
        /// <summary>
        /// Demonstrates various rendering capabilities.
        /// </summary>
        /// <param name="invocationContext"></param>
        /// <param name="sample">Renders a specified sample</param>
        /// <param name="height">The height of the rendering area</param>
        /// <param name="width">The width of the rendering area</param>
        /// <param name="top">The top position of the render area</param>
        /// <param name="left">The left position of the render area</param>
        /// <param name="text">The text to render</param>
        /// <param name="overwrite">Overwrite the specified region. (If not, scroll.)</param>
        public static void Main(
#pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
            InvocationContext invocationContext,
            SampleName sample = SampleName.Dir,
            int?height        = null,
            int?width         = null,
            int top           = 0,
            int left          = 0,
            string text       = null,
            bool overwrite    = true)
#pragma warning restore CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
        {
            var region = new Region(left,
                                    top,
                                    width ?? Console.WindowWidth,
                                    height ?? Console.WindowHeight,
                                    overwrite);

            if (overwrite &&
                invocationContext.Console is ITerminal terminal)
            {
                terminal.Clear();
            }

            var consoleRenderer = new ConsoleRenderer(
                invocationContext.Console,
                mode: invocationContext.BindingContext.OutputMode(),
                resetAfterRender: true);

            switch (sample)
            {
            case SampleName.Colors:
            {
                var screen = new ScreenView(renderer: consoleRenderer, invocationContext.Console);
                screen.Child = new ColorsView(text ?? "*");

                screen.Render(region);
            }
            break;

            case SampleName.Dir:
                var directoryTableView = new DirectoryTableView(new DirectoryInfo(Directory.GetCurrentDirectory()));
                directoryTableView.Render(consoleRenderer, region);

                break;

            case SampleName.Moby:
                consoleRenderer.RenderToRegion(
                    $"Call me {StyleSpan.BoldOn()}{StyleSpan.UnderlinedOn()}Ishmael{StyleSpan.UnderlinedOff()}{StyleSpan.BoldOff()}. Some years ago -- never mind how long precisely -- having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and {ForegroundColorSpan.Rgb(60, 0, 0)}methodically{ForegroundColorSpan.Reset()} {ForegroundColorSpan.Rgb(90, 0, 0)}knocking{ForegroundColorSpan.Reset()} {ForegroundColorSpan.Rgb(120, 0, 0)}people's{ForegroundColorSpan.Reset()} {ForegroundColorSpan.Rgb(160, 0, 0)}hats{ForegroundColorSpan.Reset()} {ForegroundColorSpan.Rgb(220, 0, 0)}off{ForegroundColorSpan.Reset()} then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me.",
                    region);
                break;

            case SampleName.Processes:
            {
                var view = new ProcessesView(Process.GetProcesses());
                view.Render(consoleRenderer, region);
            }

            break;

            case SampleName.TableView:
            {
                var table = new TableView <Process>
                {
                    Items = Process.GetProcesses().Where(x => !string.IsNullOrEmpty(x.MainWindowTitle)).OrderBy(p => p.ProcessName).ToList()
                };
                table.AddColumn(process => $"{process.ProcessName} ", "Name");
                table.AddColumn(process => ContentView.FromObservable(process.TrackCpuUsage(), x => $"{x.UsageTotal:P}"), "CPU", ColumnDefinition.Star(1));

                var screen = new ScreenView(renderer: consoleRenderer, invocationContext.Console)
                {
                    Child = table
                };
                screen.Render();
            }
            break;

            case SampleName.Clock:
            {
                var screen          = new ScreenView(renderer: consoleRenderer, invocationContext.Console);
                var lastTime        = DateTime.Now;
                var clockObservable = new BehaviorSubject <DateTime>(lastTime);
                var clockView       = ContentView.FromObservable(clockObservable, x => $"{x:T}");
                screen.Child = clockView;
                screen.Render();

                while (!Console.KeyAvailable)
                {
                    if (DateTime.Now - lastTime > TimeSpan.FromSeconds(1))
                    {
                        lastTime = DateTime.Now;
                        clockObservable.OnNext(lastTime);
                    }
                }
            }
            break;

            case SampleName.GridLayout:
            {
                var screen  = new ScreenView(renderer: consoleRenderer, invocationContext.Console);
                var content = new ContentView(
                    "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum for Kevin.");
                var smallContent = new ContentView("Kevin Bost");
                var longContent  = new ContentView("Hacking on System.CommandLine");

                var gridView = new GridView();
                gridView.SetColumns(
                    ColumnDefinition.SizeToContent(),
                    ColumnDefinition.Star(1),
                    ColumnDefinition.Star(0.5)
                    );
                gridView.SetRows(
                    RowDefinition.Star(0.5),
                    RowDefinition.Star(0.5)
                    );

                gridView.SetChild(smallContent, 0, 0);
                gridView.SetChild(longContent, 0, 1);
                //gridView.SetChild(content, 0, 0);
                gridView.SetChild(content, 1, 1);
                gridView.SetChild(content, 2, 0);

                screen.Child = gridView;

                screen.Render();
            }
            break;

            default:
                if (!string.IsNullOrWhiteSpace(text))
                {
                    consoleRenderer.RenderToRegion(
                        text,
                        region);
                }
                else
                {
                    var screen      = new ScreenView(renderer: consoleRenderer, invocationContext.Console);
                    var stackLayout = new StackLayoutView();
                    var content1    = new ContentView("Hello World!");
                    var content2    = new ContentView(
                        "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum for Kevin.");
                    stackLayout.Add(content2);
                    stackLayout.Add(content1);
                    stackLayout.Add(content2);
                    screen.Child = stackLayout;
                    screen.Render(new Region(0, 0, 50, Size.MaxValue));
                    //screen.Render(writer);
                }

                break;
            }

            if (!Console.IsOutputRedirected)
            {
                Console.ReadKey();
            }
        }
コード例 #19
0
 public SampleNameChange(SampleName _sampleName, ViewName _viewName)
 {
     SampleName = _sampleName;
     ViewName   = _viewName;
 }