private void btnCloseDeviceList_Click(object sender, EventArgs e) { bool IsDirtyOrEmptyPath = (DeviceDataManager.IsDirty || string.IsNullOrEmpty(DeviceDataManager.DeviceListFilePath)); if (IsDirtyOrEmptyPath) { var dlgResult = MessageBox.Show("Do you want to save the content?", "Want to Save", buttons: MessageBoxButtons.YesNoCancel); if (dlgResult == DialogResult.Yes) { DeviceDataManager.SaveDataToCSV(); ClearDeviceList(); } else if (dlgResult == DialogResult.No) { ClearDeviceList(); } else if (dlgResult == DialogResult.Cancel) { // Dont do anything, Cancelling Out........... } } else if (!IsDirtyOrEmptyPath) { var dlgResult = MessageBox.Show("Do you want to proceed? It will clear the current list.", "Want to Proceed", buttons: MessageBoxButtons.YesNo); if (dlgResult == DialogResult.Yes) { ClearDeviceList(); } else if (dlgResult == DialogResult.No) { // Dont do anything, Cancelling Out........... } } }
private void btnOpenDeviceList_Click(object sender, EventArgs e) { if (DeviceDataManager.IsDirty) { var dlgResult = MessageBox.Show("Do you want to save the content?", "Want to Save", MessageBoxButtons.YesNoCancel); if (dlgResult == DialogResult.Yes) { DeviceDataManager.SaveDataToCSV(); OpenDeviceListFile(); } else if (dlgResult == DialogResult.No) { OpenDeviceListFile(); } else if (dlgResult == DialogResult.Cancel) { // Do nothing, Cancelling out the Open file } } else if (!DeviceDataManager.IsDirty) { //var dlgResult = MessageBox.Show("Do you want to proceed? It will clear the current list.", "Want to Proceed", buttons: MessageBoxButtons.YesNo); //if (dlgResult == DialogResult.Yes) //{ // ClearDeviceList(); //} //else if (dlgResult == DialogResult.No) //{ // // Dont do anything, Cancelling Out........... //} // Not required As of now...... OpenDeviceListFile(); } // OpenDeviceListFile(); }
private void btnSaveAsDeviceList_Click(object sender, EventArgs e) { DeviceDataManager.SaveDataToCSV(SaveAs: true); }