Help with elevator project


Hi everyone, well I have trying to do an elevator simulator, wich have to includo the panel with the floor, available floors, and a button panel with available floors and button up, down, but I dont understand is how to use the timers for up and down, because I vague idea to select the floors is to usea a for or select case but I dont know wich one is the most appropiate in this case. Wha tI have so far is:



```
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Timer2.Enabled = False
        If lbl1.Text = "4" Then
            lbl1.Text = "1"
        Else
            lbl1.Text = Val(lbl1.Text) + 1
        End If
        Button1_Click("", e)
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Timer1.Enabled = True
        If lbl1.Text = "4" Then
            lbl1.Text = "1"
        Else
            lbl1.Text = Val(lbl1.Text) - 1
        End If
        Button2_Click("", e)
    End Sub

    Private Sub nvl1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nvl1.CheckedChanged
        If nvl1.Checked = True Then
            shp1.BackColor = Color.Red
            lbl1_nvl1.ForeColor = Color.Red
        Else
            shp1.BackColor = Color.Green
            lbl1_nvl1.ForeColor = Color.Green
            shp2.BackColor = Color.Red
            lbl2_nvl2.ForeColor = Color.Red
            shp3.BackColor = Color.Red
            lbl3_nvl3.ForeColor = Color.Red
        End If
    End Sub

    Private Sub nvl2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nvl2.CheckedChanged
        If nvl2.Checked = True Then
            shp2.BackColor = Color.Red
            lbl2_nvl2.ForeColor = Color.Red
        Else
            shp2.BackColor = Color.Green
            lbl2_nvl2.ForeColor = Color.Green
            shp1.BackColor = Color.Red
            lbl1_nvl1.ForeColor = Color.Red
            shp3.BackColor = Color.Red
            lbl3_nvl3.ForeColor = Color.Red
        End If
    End Sub

    Private Sub nvl3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nvl3.CheckedChanged
        If nvl3.Checked = True Then
            shp3.BackColor = Color.Red
            lbl3_nvl3.ForeColor = Color.Red
        Else
            shp3.BackColor = Color.Green
            lbl3_nvl3.ForeColor = Color.Green
            shp1.BackColor = Color.Red
            lbl1_nvl1.ForeColor = Color.Red
            shp2.BackColor = Color.Red
            lbl2_nvl2.ForeColor = Color.Red
        End If
    End Sub
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        If lbl1.Text = "1" Then
            nvl1.Checked = True
        ElseIf lbl1.Text = "2" Then
            nvl2.Checked = True
        ElseIf lbl1.Text = "3" Then
            nvl3.Checked = True
        ElseIf lbl1.Text = "4" Then
            nvl4.Checked = True
        End If
    End Sub
    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        If lbl1.Text = "1" Then
            nvl1.Checked = True
        ElseIf lbl1.Text = "2" Then
            nvl2.Checked = True
        ElseIf lbl1.Text = "3" Then
            nvl3.Checked = True
        ElseIf lbl1.Text = "4" Then
            nvl4.Checked = True
        End If
    End Sub
```

This just shows the levels and the timer1 just go up and a little "screen" shows at what floors is the elevator but this just go up and start from one again.



Thanks in advance for the help.
You must enable only one timer at a time.  

Timer1 to go up.  

Timer2 to go down.



When any Timer reaches the destination floor, it shoud be self disabled.



On both timers you check for floor 4. IMO you should chek if the current floor is the destination or greater on timer1 and the destination or lower in timer2.



Hope this helps
hi andrew penny, - - just add this namespace definition: - xmlns:system=clr-namespace:system;assembly=mscorlib - - there are differences in parsing between wpf and silverlight and that is the reason we used the syntax below. if you develop silverlight application you can set it as follows: - - discreteobjectkeyframe keytime=0.00:00:00.0 value=2 /> - - - best wishes, - sia - the telerik team - - - do you want to have your say when we set our development plans? - do you want to know when a feature you care about is added or when a bug fixed? - explore the - telerik public issue tracking - system and vote to affect the priority of the items - - 1) form controls use a list box for the names of the conference rooms;use datetimepicker for scheduling the reservation...set the format property to custom;set the customformat property to mm dd yyyy hh mm ssof course, will also need ok button2) dataset up the data file like this:room date time1st floor, 6/8/21, 14:00:002nd floor, 6/9/21, 10:00:003rd floor, 6/8/21, 13:30:00reads these records from the file to determine if there is a conflict.if the room is available at the requested time, writes the reservation tothe file (in append mode) and displays a message box saying the reservationis complete. otherwise display a message box saying the room is unavailableat that time. i wouldn’t touch the python. add it into a custom node so you can make use of list levels and lacing instead. th is will also make it easier to maintain your code over time. update to everything:

i’ve now made a playlist, this is pretty awesome ngl. here you’ll find everything automatically labelled “tower takeover cad” from me, and i’ll occassionally go through and add in my explanations.

also: here’s a link to the 2018 parts library [https://drive.goog…](https://drive.google.com/open?id=1qxjcdodescticrltgwqu7qypofiorxoq) for posterity, the issue was a different environment was being used in the ijulia notebook, which contained pavito, causing jump to downgrade.

for others finding this, here is the documentation on pkg environments:

[image]

[4. working with environments · pkg.jl](https://julialang.github.io/pkg.jl/v1/environments/) [image] ryan\_blything:

i have difficulty understanding why (since ultimately, rts should be dependent on keyboard press rather than frame rate).

builder experiments are structured around a drawing loop and event cycle that is driven by the screen refresh rate. so the keyboard is checked once … 4th attempt! Now handles GroupItems. Feel free to ignore attempt 3, I've left it just for learning purposes. There are two ways you may want to handle groups: 1) calculate area for each individual item inside the group, or 2) calculate the aggregate area of all the grouped items. If you want option 2) just comment out the itemsInsideGroupItems line.

 

Just for fun I also changed the way the parameters work for specifying the target area value and unit. I put them in a string. Example values are: '4 square inches', '4in','4 sq inch' will give same result. Other examples are:'100mm', '800 pt'. If the parameter is a number, not a string, it will be interpreted as points.

 

 


```
// start with the selected items
var items = app.activeDocument.selection;

// comment out the following line if you want each groups' area to be calculated, rather than the items inside each group individually
items = itemsInsideGroupItems(items);

// this is where you specify your target size ()
scaleItemsToArea(items, '4 square inches');

function scaleItemsToArea(items, targetString) {
    // very simple parsing of targetString
    targetString = String (targetString);
    var targetAreaInSquareUnits = Number(targetString.match(/\d+/)[0]);
    var unitType;
    // note: only looks for 'in' or 'mm'
    if (targetString.search(/(in|\")/) > -1) {
        unitType = 'in';
    } else if (targetString.search(/mm/) > -1) {
        unitType = 'mm';
    } else {
        unitType = 'pt'
    }
    // scale each item
    for (var i = 0; i < items.length; i++) {
        scaleToArea(items[i], targetAreaInSquareUnits, unitType);
    }
}
function scaleToArea(item, targetAreaInSquareUnits, unitType) {
    var itemAreaInSquareUnits = areaOfItem(item, unitType);
    var scaleFactor = (Math.sqrt(targetAreaInSquareUnits / itemAreaInSquareUnits)) * 100;
    if (scaleFactor != NaN) {
        item.resize(scaleFactor, scaleFactor);
    }
}
function areaOfItem(item, unitType) {
    var itemAreaInSquareUnits;
    var itemAreaInSquarePoints = areaOfItemInSquarePoints(item);
    if (unitType == 'in') {
        var ptsIn1inch = 72;
        itemAreaInSquareUnits = itemAreaInSquarePoints / (ptsIn1inch * ptsIn1inch);
    } else if (unitType == 'mm') {
        var ptsIn1mm = 2.834645669;
        itemAreaInSquareUnits = itemAreaInSquarePoints / (ptsIn1mm * ptsIn1mm);
    } else {
        // no unitType specified, use points
        itemAreaInSquareUnits = itemAreaInSquarePoints;
    }
    return itemAreaInSquareUnits;
}
function areaOfItemInSquarePoints(item) {
    var area = 0;
    if (item.typename == 'PathItem') {
        area = item.area;
    } else if (item.typename == 'CompoundPathItem') {
        for (var j = 0; j < item.pathItems.length; j++) {
            area += item.pathItems[j].area;
            // $.writeln('item.pathItems[j].area = ' + item.pathItems[j].area + '     area = ' + area);
        }
    } else if (item.typename == 'GroupItem') {
        for (var j = 0; j < item.pageItems.length; j++) {
            area += areaOfItemInSquarePoints(item.pageItems[j]);
            // $.writeln('item.pathItems[j].area = ' + item.pathItems[j].area + '     area = ' + area);
        }
    } else {
        // for other types of items, resort to width x height
        area = item.width * item.height;
    }
    return Math.abs(Math.round(area * 10000) / 10000);
}
function itemsInsideGroupItems(items) {
    // returns an array containing items, including items found inside GroupItems
    try {
        var found = [];
        for (var i = 0; i < items.length; i++) {
            var item = items[i];
            if (item.typename == 'GroupItem') {
                found = found.concat(itemsInsideGroupItems(item.pageItems));
            } else {
                found.push(item);
            }
        }
        return found;
    } catch (e) {
        return found;
    }
}
```
 

 

As usual, not much testing done, so please let me know if it works as you'd expect. - Mark You can provide an optional parameter to the scaffolding command to update only the table you target.



```
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=DatabaseName;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir DirectoryNameOfYourModels -Tables employee -f

```

If you are using .net core cli then use.



```
dotnet ef dbcontext scaffold "Server=(localdb)\mssqllocaldb;Database=DatabaseName;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o DirectoryNameOfYourModels -t employee -f

``` howdy and welcome to the forum!

take a closer look at the comment on line 13…it suggests using a different method

you are incrementing enemyindex, but not quite in the correct place…it should be the final statement in your while(enemyindex…) loop

like item 1, don’t forget the instructions in the c… Hi,  

  

check the following Code  

SQLCopy Code

```
-- Question 1 Answer
SELECT E.EmployeeID,E.Day, (E.TotalTime/60) 'TotalHours', (E.TotalTime%60) 'Minites'
FROM (SELECT EmployeeID,CONVERT(VARCHAR(10),FromTime,102) 'Day',SUM(DATEDIFF(mi,FromTime,ToTime)) 'TotalTime'
      FROM tblEmployeeTimeCard
      GROUP BY EmployeeID,CONVERT(VARCHAR(10),FromTime,102))E

-- Question 1&2 Answer
SELECT E.EmployeeID,E.Day, (E.TotalTime/60) 'TotalHours', (E.TotalTime%60) 'Minites',
CASE WHEN (E.TotalTime/60)>=6 THEN E.TotalTime - (30* ROUND((E.TotalTime/60*6),1))
     ELSE (E.TotalTime/60) END 'TotalWorkHours'
FROM (SELECT EmployeeID,CONVERT(VARCHAR(10),FromTime,102) 'Day',SUM(DATEDIFF(mi,FromTime,ToTime)) 'TotalTime'
      FROM tblEmployeeTimeCard
      GROUP BY EmployeeID,CONVERT(VARCHAR(10),FromTime,102))E
```
  

  

For ur Question 2, I am not getting. give some more details about that. if possible send some sample data. if access over lap like (From date is 2013 -04-05 11:55:00PM to 2013-04-05 19:10:00PM)  

then we can't able to fine the time difference. So check the code for Question No 1 and give the feedback.  

  

Regards,  

GVPrabu