Imports System.ComponentModel
Imports DevExpress.Utils

Public Class frmWorkflowOverview
    Private WorkflowItems As BindingList(Of WorkflowItem)
    Private WorkflowDetails As BindingList(Of WorkflowDetail)

    Private Async Sub frmWorkflowOverview_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim oDatatable As DataTable
        Dim oWorkflows As New List(Of WorkflowItem)

        Dim oIconMap As New Dictionary(Of String, String) From {
            {"Start", "ampel_gruen"},
            {"not started", "ampel_rot"}
        }

        Try
            oDatatable = Await My.Common.Views.VWIDB_GUI_WF_OVERVIEW(70, 104)

            For Each oRow As DataRow In oDatatable.Rows
                oWorkflows.Add(New WorkflowItem(oIconMap) With {
                     .Title = oRow.Item("REQUEST_TITLE"),
                     .State = oRow.Item("STATETITLE"),
                     .Process = oRow.Item("PROCESS_NAME"),
                     .Raw = oRow
                })
            Next
        Catch ex As Exception
            ShowErrorMessage(ex)
        End Try

        GridOverview.DataSource = oWorkflows
        NavControlOverview.DataSource = oWorkflows





        'gvOverview.GroupFormat = "[#image]{1} {2}"
        'With gvOverview.Columns.Item("CreatedAt")
        '    .OptionsFilter.FilterPopupMode = DevExpress.XtraGrid.Columns.FilterPopupMode.DateAlt
        '    .GroupInterval = DevExpress.XtraGrid.ColumnGroupInterval.DateRange
        '    .SortOrder = DevExpress.Data.ColumnSortOrder.Descending
        '    .Group()
        'End With

    End Sub

    Private Sub frmWorkflowOverview_Shown(sender As Object, e As EventArgs) Handles Me.Shown
        RibbonControl1.SelectPage(RibbonPage3)
    End Sub
End Class