Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. What is the equivalent code in c#?

What is the equivalent code in c#?

Scheduled Pinned Locked Moved C#
delphiquestioncsharpgraphics
17 Posts 9 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Milad Biroonvand

    What is the equivalent code in c#? This is Delphi code Thanks!

    {
    ***** Process scheduling - FCFS, HRRN, SPN simulator ********
    **
    ** Tested on Microsoft Windows XP SP2
    **
    ** Written with Borland Delphi 7 Enterprise edition
    **
    *******************************************************

    **
    *******************************************************
    * Greets:
    **
    ** To my dear mother, father & anybody who supports me
    **
    ******************************************************* }

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, Buttons, ExtCtrls, XPMan, ComCtrls;

    (****************************************************************************)
    Type
    TProcess=Record
    Name:String;
    ArrivalTime:Integer;
    ServiceTime:Integer;
    FinishTime:Integer;
    TimeLeft:Integer;
    Tq:Integer; {Turnaround time: total time in system, waiting + execution}
    TqDivTs:Real; {Tq/Ts: Is the normalized turnaround time.
    This value indicates the
    relative delay experienced by a process.}
    end;
    (****************************************************************************)
    Type TOrigin=Packed Record
    X: Longint;
    Y: Longint;
    end;
    (****************************************************************************)
    Type
    TForm1 = class(TForm)
    XPManifest1: TXPManifest;
    SaveDialog1: TSaveDialog;
    SaveDialog2: TSaveDialog;
    MemoService: TMemo;
    Memo1: TMemo;
    MemoArrival: TMemo;
    MemoProcess: TMemo;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Image1: TImage;
    BtnStart: TBitBtn;
    btnSavePicture: TBitBtn;
    btnSaveLog: TBitBtn;
    ComboScheduling: TComboBox;
    Label5: TLabel;
    StatusBar1: TStatusBar;
    procedure ComboSchedulingSelect(Sender: TObject);
    procedure MemoArrivalKeyPress(Sender: TObject; var Key: Char);
    procedure MemoServiceKeyPress(Sender: TObject; var Key: Char);
    procedure BtnStartClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure btnSavePictureClick(Sender: TObject);
    procedure btnSaveLogClick(Sender: TObject);
    (****************************************************************************)
    private
    Procedure SortQueue;
    Procedure CheckErrors;
    Procedure ClearCanvas;
    Procedure FilterNumericKeys(var Memo:TMemo;var Key:Char); // don't let to enter non-numeric keys

    L Offline
    L Offline
    Luc Pattyn
    wrote on last edited by
    #4

    For starters, you need to replace multiplications ('*') by divisions ('/'). I don't know Delphi well enough to help you further though. :-D

    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

    Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

    D H 2 Replies Last reply
    0
    • L Luc Pattyn

      For starters, you need to replace multiplications ('*') by divisions ('/'). I don't know Delphi well enough to help you further though. :-D

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

      D Offline
      D Offline
      Dan Mos
      wrote on last edited by
      #5

      :thumbsup: :laugh:

      All the best, Dan

      1 Reply Last reply
      0
      • M Milad Biroonvand

        What is the equivalent code in c#? This is Delphi code Thanks!

        {
        ***** Process scheduling - FCFS, HRRN, SPN simulator ********
        **
        ** Tested on Microsoft Windows XP SP2
        **
        ** Written with Borland Delphi 7 Enterprise edition
        **
        *******************************************************

        **
        *******************************************************
        * Greets:
        **
        ** To my dear mother, father & anybody who supports me
        **
        ******************************************************* }

        unit Unit1;

        interface

        uses
        Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
        Dialogs, StdCtrls, Buttons, ExtCtrls, XPMan, ComCtrls;

        (****************************************************************************)
        Type
        TProcess=Record
        Name:String;
        ArrivalTime:Integer;
        ServiceTime:Integer;
        FinishTime:Integer;
        TimeLeft:Integer;
        Tq:Integer; {Turnaround time: total time in system, waiting + execution}
        TqDivTs:Real; {Tq/Ts: Is the normalized turnaround time.
        This value indicates the
        relative delay experienced by a process.}
        end;
        (****************************************************************************)
        Type TOrigin=Packed Record
        X: Longint;
        Y: Longint;
        end;
        (****************************************************************************)
        Type
        TForm1 = class(TForm)
        XPManifest1: TXPManifest;
        SaveDialog1: TSaveDialog;
        SaveDialog2: TSaveDialog;
        MemoService: TMemo;
        Memo1: TMemo;
        MemoArrival: TMemo;
        MemoProcess: TMemo;
        Label1: TLabel;
        Label2: TLabel;
        Label3: TLabel;
        Image1: TImage;
        BtnStart: TBitBtn;
        btnSavePicture: TBitBtn;
        btnSaveLog: TBitBtn;
        ComboScheduling: TComboBox;
        Label5: TLabel;
        StatusBar1: TStatusBar;
        procedure ComboSchedulingSelect(Sender: TObject);
        procedure MemoArrivalKeyPress(Sender: TObject; var Key: Char);
        procedure MemoServiceKeyPress(Sender: TObject; var Key: Char);
        procedure BtnStartClick(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure btnSavePictureClick(Sender: TObject);
        procedure btnSaveLogClick(Sender: TObject);
        (****************************************************************************)
        private
        Procedure SortQueue;
        Procedure CheckErrors;
        Procedure ClearCanvas;
        Procedure FilterNumericKeys(var Memo:TMemo;var Key:Char); // don't let to enter non-numeric keys

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #6

        Bad news for you here I'm afraid. You've hit a limit in the number of characters that are being displayed. This is a new limit in CP.

        I'm not a stalker, I just know things. Oh by the way, you're out of milk.

        Forgive your enemies - it messes with their heads

        My blog | My articles | MoXAML PowerToys | Onyx

        L 1 Reply Last reply
        0
        • P Pete OHanlon

          Bad news for you here I'm afraid. You've hit a limit in the number of characters that are being displayed. This is a new limit in CP.

          I'm not a stalker, I just know things. Oh by the way, you're out of milk.

          Forgive your enemies - it messes with their heads

          My blog | My articles | MoXAML PowerToys | Onyx

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #7

          And yet you're the latest character that somehow sneaked into this thread??? :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          P 1 Reply Last reply
          0
          • L Luc Pattyn

            For starters, you need to replace multiplications ('*') by divisions ('/'). I don't know Delphi well enough to help you further though. :-D

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

            H Offline
            H Offline
            Henry Minute
            wrote on last edited by
            #8

            Naughty Luc!

            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

            L 1 Reply Last reply
            0
            • H Henry Minute

              Naughty Luc!

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #9

              If comments are to be ignored by the compiler, they better start with a slash, not an asterisk. Or would you suggest an #if false block? :confused:

              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

              Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

              H 1 Reply Last reply
              0
              • L Luc Pattyn

                If comments are to be ignored by the compiler, they better start with a slash, not an asterisk. Or would you suggest an #if false block? :confused:

                Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                H Offline
                H Offline
                Henry Minute
                wrote on last edited by
                #10

                If you had said 'asterisks' by 'forward slashes' I would agree. I thought that the use of the terms for arithmetic operations a touch mischievous. :-D

                Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                L 1 Reply Last reply
                0
                • H Henry Minute

                  If you had said 'asterisks' by 'forward slashes' I would agree. I thought that the use of the terms for arithmetic operations a touch mischievous. :-D

                  Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #11

                  Moi? :omg:

                  Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                  Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                  H 1 Reply Last reply
                  0
                  • L Luc Pattyn

                    Moi? :omg:

                    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                    Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                    H Offline
                    H Offline
                    Henry Minute
                    wrote on last edited by
                    #12

                    Ja!

                    Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                    1 Reply Last reply
                    0
                    • L Luc Pattyn

                      And yet you're the latest character that somehow sneaked into this thread??? :)

                      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                      Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #13

                      With my Jedi capabilities, I blow the limit apart. Strong in the force am I.

                      I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                      Forgive your enemies - it messes with their heads

                      My blog | My articles | MoXAML PowerToys | Onyx

                      L 1 Reply Last reply
                      0
                      • P Pete OHanlon

                        With my Jedi capabilities, I blow the limit apart. Strong in the force am I.

                        I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                        Forgive your enemies - it messes with their heads

                        My blog | My articles | MoXAML PowerToys | Onyx

                        L Offline
                        L Offline
                        Luc Pattyn
                        wrote on last edited by
                        #14

                        For a short moment, you sound more like some kind of Terminator. Didn't supper agree with you? :)

                        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                        1 Reply Last reply
                        0
                        • M Milad Biroonvand

                          What is the equivalent code in c#? This is Delphi code Thanks!

                          {
                          ***** Process scheduling - FCFS, HRRN, SPN simulator ********
                          **
                          ** Tested on Microsoft Windows XP SP2
                          **
                          ** Written with Borland Delphi 7 Enterprise edition
                          **
                          *******************************************************

                          **
                          *******************************************************
                          * Greets:
                          **
                          ** To my dear mother, father & anybody who supports me
                          **
                          ******************************************************* }

                          unit Unit1;

                          interface

                          uses
                          Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
                          Dialogs, StdCtrls, Buttons, ExtCtrls, XPMan, ComCtrls;

                          (****************************************************************************)
                          Type
                          TProcess=Record
                          Name:String;
                          ArrivalTime:Integer;
                          ServiceTime:Integer;
                          FinishTime:Integer;
                          TimeLeft:Integer;
                          Tq:Integer; {Turnaround time: total time in system, waiting + execution}
                          TqDivTs:Real; {Tq/Ts: Is the normalized turnaround time.
                          This value indicates the
                          relative delay experienced by a process.}
                          end;
                          (****************************************************************************)
                          Type TOrigin=Packed Record
                          X: Longint;
                          Y: Longint;
                          end;
                          (****************************************************************************)
                          Type
                          TForm1 = class(TForm)
                          XPManifest1: TXPManifest;
                          SaveDialog1: TSaveDialog;
                          SaveDialog2: TSaveDialog;
                          MemoService: TMemo;
                          Memo1: TMemo;
                          MemoArrival: TMemo;
                          MemoProcess: TMemo;
                          Label1: TLabel;
                          Label2: TLabel;
                          Label3: TLabel;
                          Image1: TImage;
                          BtnStart: TBitBtn;
                          btnSavePicture: TBitBtn;
                          btnSaveLog: TBitBtn;
                          ComboScheduling: TComboBox;
                          Label5: TLabel;
                          StatusBar1: TStatusBar;
                          procedure ComboSchedulingSelect(Sender: TObject);
                          procedure MemoArrivalKeyPress(Sender: TObject; var Key: Char);
                          procedure MemoServiceKeyPress(Sender: TObject; var Key: Char);
                          procedure BtnStartClick(Sender: TObject);
                          procedure FormCreate(Sender: TObject);
                          procedure btnSavePictureClick(Sender: TObject);
                          procedure btnSaveLogClick(Sender: TObject);
                          (****************************************************************************)
                          private
                          Procedure SortQueue;
                          Procedure CheckErrors;
                          Procedure ClearCanvas;
                          Procedure FilterNumericKeys(var Memo:TMemo;var Key:Char); // don't let to enter non-numeric keys

                          _ Offline
                          _ Offline
                          _Erik_
                          wrote on last edited by
                          #15

                          The best advise I can give about this is: Try to do it yourself and ask when you have a concrete problem. By the way, I think you're gonna achieve a new record of downvotes with this post.

                          1 Reply Last reply
                          0
                          • M Milad Biroonvand

                            What is the equivalent code in c#? This is Delphi code Thanks!

                            {
                            ***** Process scheduling - FCFS, HRRN, SPN simulator ********
                            **
                            ** Tested on Microsoft Windows XP SP2
                            **
                            ** Written with Borland Delphi 7 Enterprise edition
                            **
                            *******************************************************

                            **
                            *******************************************************
                            * Greets:
                            **
                            ** To my dear mother, father & anybody who supports me
                            **
                            ******************************************************* }

                            unit Unit1;

                            interface

                            uses
                            Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
                            Dialogs, StdCtrls, Buttons, ExtCtrls, XPMan, ComCtrls;

                            (****************************************************************************)
                            Type
                            TProcess=Record
                            Name:String;
                            ArrivalTime:Integer;
                            ServiceTime:Integer;
                            FinishTime:Integer;
                            TimeLeft:Integer;
                            Tq:Integer; {Turnaround time: total time in system, waiting + execution}
                            TqDivTs:Real; {Tq/Ts: Is the normalized turnaround time.
                            This value indicates the
                            relative delay experienced by a process.}
                            end;
                            (****************************************************************************)
                            Type TOrigin=Packed Record
                            X: Longint;
                            Y: Longint;
                            end;
                            (****************************************************************************)
                            Type
                            TForm1 = class(TForm)
                            XPManifest1: TXPManifest;
                            SaveDialog1: TSaveDialog;
                            SaveDialog2: TSaveDialog;
                            MemoService: TMemo;
                            Memo1: TMemo;
                            MemoArrival: TMemo;
                            MemoProcess: TMemo;
                            Label1: TLabel;
                            Label2: TLabel;
                            Label3: TLabel;
                            Image1: TImage;
                            BtnStart: TBitBtn;
                            btnSavePicture: TBitBtn;
                            btnSaveLog: TBitBtn;
                            ComboScheduling: TComboBox;
                            Label5: TLabel;
                            StatusBar1: TStatusBar;
                            procedure ComboSchedulingSelect(Sender: TObject);
                            procedure MemoArrivalKeyPress(Sender: TObject; var Key: Char);
                            procedure MemoServiceKeyPress(Sender: TObject; var Key: Char);
                            procedure BtnStartClick(Sender: TObject);
                            procedure FormCreate(Sender: TObject);
                            procedure btnSavePictureClick(Sender: TObject);
                            procedure btnSaveLogClick(Sender: TObject);
                            (****************************************************************************)
                            private
                            Procedure SortQueue;
                            Procedure CheckErrors;
                            Procedure ClearCanvas;
                            Procedure FilterNumericKeys(var Memo:TMemo;var Key:Char); // don't let to enter non-numeric keys

                            G Offline
                            G Offline
                            GenJerDan
                            wrote on last edited by
                            #16

                            https://www.turnsharp.com/delphi-to-csharp.aspx[^] Have no idea if it works well enough to bother with.

                            1 Reply Last reply
                            0
                            • M Milad Biroonvand

                              What is the equivalent code in c#? This is Delphi code Thanks!

                              {
                              ***** Process scheduling - FCFS, HRRN, SPN simulator ********
                              **
                              ** Tested on Microsoft Windows XP SP2
                              **
                              ** Written with Borland Delphi 7 Enterprise edition
                              **
                              *******************************************************

                              **
                              *******************************************************
                              * Greets:
                              **
                              ** To my dear mother, father & anybody who supports me
                              **
                              ******************************************************* }

                              unit Unit1;

                              interface

                              uses
                              Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
                              Dialogs, StdCtrls, Buttons, ExtCtrls, XPMan, ComCtrls;

                              (****************************************************************************)
                              Type
                              TProcess=Record
                              Name:String;
                              ArrivalTime:Integer;
                              ServiceTime:Integer;
                              FinishTime:Integer;
                              TimeLeft:Integer;
                              Tq:Integer; {Turnaround time: total time in system, waiting + execution}
                              TqDivTs:Real; {Tq/Ts: Is the normalized turnaround time.
                              This value indicates the
                              relative delay experienced by a process.}
                              end;
                              (****************************************************************************)
                              Type TOrigin=Packed Record
                              X: Longint;
                              Y: Longint;
                              end;
                              (****************************************************************************)
                              Type
                              TForm1 = class(TForm)
                              XPManifest1: TXPManifest;
                              SaveDialog1: TSaveDialog;
                              SaveDialog2: TSaveDialog;
                              MemoService: TMemo;
                              Memo1: TMemo;
                              MemoArrival: TMemo;
                              MemoProcess: TMemo;
                              Label1: TLabel;
                              Label2: TLabel;
                              Label3: TLabel;
                              Image1: TImage;
                              BtnStart: TBitBtn;
                              btnSavePicture: TBitBtn;
                              btnSaveLog: TBitBtn;
                              ComboScheduling: TComboBox;
                              Label5: TLabel;
                              StatusBar1: TStatusBar;
                              procedure ComboSchedulingSelect(Sender: TObject);
                              procedure MemoArrivalKeyPress(Sender: TObject; var Key: Char);
                              procedure MemoServiceKeyPress(Sender: TObject; var Key: Char);
                              procedure BtnStartClick(Sender: TObject);
                              procedure FormCreate(Sender: TObject);
                              procedure btnSavePictureClick(Sender: TObject);
                              procedure btnSaveLogClick(Sender: TObject);
                              (****************************************************************************)
                              private
                              Procedure SortQueue;
                              Procedure CheckErrors;
                              Procedure ClearCanvas;
                              Procedure FilterNumericKeys(var Memo:TMemo;var Key:Char); // don't let to enter non-numeric keys

                              P Offline
                              P Offline
                              Pete OHanlon
                              wrote on last edited by
                              #17

                              When you do do it, please try to give your variables more meaningful names. M is a string? :omg:

                              I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                              Forgive your enemies - it messes with their heads

                              My blog | My articles | MoXAML PowerToys | Onyx

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups