using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Linq;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
using DevExpress.XtraEditors;
|
using DevExpress.XtraEditors.Filtering;
|
using DevExpress.Utils;
|
using DevExpress.XtraGrid.Views.Grid;
|
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
|
using DevExpress.XtraGrid.Columns;
|
using IStation.Extensions;
|
|
namespace IStation.WinFormUI.Project
|
{
|
public partial class OpenProjectOverviewDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public OpenProjectOverviewDlg()
|
{
|
InitializeComponent();
|
this.IconOptions.Icon = Properties.Resource.app;
|
this.layoutControl1.SetupLayoutControl();
|
this.projectTileViewCtrl1.ReloadDataEvent += ProjectTileViewListCtrl1_ReloadDataEvent;
|
}
|
|
//打开项目
|
private void ProjectTileViewListCtrl1_ReloadDataEvent(Model.Project obj)
|
{
|
if (GlobalParas.ProjectId == obj.Id)
|
{
|
XtraMessageBox.Show("无法打开正在使用的项目!");
|
return;
|
}
|
|
var bol = ProjectHelper.LoadProject(obj.Id);
|
if (!bol)
|
{
|
XtraMessageBox.Show("项目加载失败!");
|
Application.Exit();
|
return;
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData()
|
{
|
var allPrj = new BLL.Project().GetAll();
|
if (allPrj == null)
|
allPrj = new List<Model.Project>();
|
this.projectTileViewCtrl1.SetBindingData(allPrj);
|
}
|
|
//打开项目
|
private void tileOpenPrj_ItemClick(object sender, TileItemEventArgs e)
|
{
|
var filePath = ProjectHelper.GetOpenProjectPath();
|
if (string.IsNullOrEmpty(filePath))
|
return;
|
var projecId = ProjectHelper.ImportProject(filePath);
|
if (projecId<1)
|
{
|
XtraMessageBox.Show("项目加载失败!");
|
Application.Exit();
|
return;
|
}
|
GlobalParas.ProjectId = projecId;
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
|
}
|
}
|