// Executors private static Window CreateWindow9_2(string path) { var window = new Window("window9_2", Path.Combine(path, @"generic/bg.raw")); window.AddChild(new RawButton("window9_home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247) { OnRelease = () => mApplication.SetFocusedWindow("window1") }); var list = new ListWidget("list", 10, 75, new[] { 300 }, TextTable.CreateOffset(6, 25)); window.OnShow = () => { var executors = mDeviceControl.SettingsStorage.Load().Executors; list.Items = executors.ConvertAll(e => new ListWidget.Item { Column1 = e, Id = e }).ToArray(); }; window.AddChild(list); window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_up.raw"), Path.Combine(path, "9/2/bt_up_pr.raw"), 340, 175) { OnRelease = list.Up }); window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_choose.raw"), Path.Combine(path, "9/2/bt_choose_pr.raw"), 340, 135) { OnRelease = () => { var settings = mDeviceControl.SettingsStorage.Load(); settings.Executors = list.Items.ToList().ConvertAll(i => i.Column1); settings.LastUsedExecutor = (string)list.CurrentSelection; mDeviceControl.SettingsStorage.Save(settings); var rv = mApplication.GetWindows().First(w => w.Name == "window2") as Window; if (rv == null) { return; } rv.OnShow(); mApplication.SetFocusedWindow(rv); } }); window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_down.raw"), Path.Combine(path, "9/2/bt_down_pr.raw"), 340, 65) { OnRelease = list.Down }); window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_add.raw"), Path.Combine(path, "9/2/bt_add_pr.raw"), 320, 5)//340, 5) { OnRelease = () => { mKeyboardWindow.OnEnter = returnText => { if (!string.IsNullOrWhiteSpace(returnText)) { var newItems = new ListWidget.Item[list.Items.Length + 1]; Array.Copy(list.Items, newItems, list.Items.Length); newItems[list.Items.Length] = new ListWidget.Item { Column1 = returnText, Id = returnText }; list.Items = newItems; } }; mKeyboardWindow.ReturnWindow = "window9_2"; mApplication.SetFocusedWindow("keyboard_window"); } }); window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_delete.raw"), Path.Combine(path, "9/2/bt_delete_pr.raw"), 185, 5)//205, 5) { OnRelease = () => { var newItems = list.Items.ToList(); newItems.RemoveAll(i => i.Id == list.CurrentSelection); list.Items = newItems.ToArray(); } }); window.AddChild(new RawButton("", Path.Combine(path, "9/2/bt_back.raw"), Path.Combine(path, "9/2/bt_back_pr.raw"), 20, 5) { OnRelease = () => mApplication.SetFocusedWindow("window2") }); return(window); }
private static IWidget CreateWindow7(string path) { var window = new Window("window7", Path.Combine(path, @"generic/bg.raw")); window.AddChild(new RawButton("window7_home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247) { OnRelease = () => mApplication.SetFocusedWindow("window1") }); window.AddChild(new TextArea("", null, 30, 210, 350) { Text = "Отчёт о проведенном измерении", Size = 16, Color = new Color { R = 1.0f, G = 1.0f, B = 1.0f } }); var table = new TextTable("window7.table", 15, 70, new[] { 180, 130 }, TextTable.CreateOffset(5, 22), new[] { 2, 4 }, null, 16); table.Cells[0, 0].Text = "Проба:"; table.Cells[0, 1].Text = "Результат АОА:"; table.Cells[0, 2].Text = "Результат ОА:"; table.Cells[0, 3].Text = "Исполнитель:"; table.Cells[0, 4].Text = "Дата:"; window.AddChild(table); window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_next_measurement.raw"), Path.Combine(path, "RawButtons/bt_next_measurement_pr.raw"), 350, 5) { OnRelease = () => mApplication.SetFocusedWindow("window2") }); window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_repeat_measurement.raw"), Path.Combine(path, "RawButtons/bt_repeat_measurement_pr.raw"), 350, 165) { OnRelease = () => { mMeasureController.Reset(); mApplication.SetFocusedWindow("window3"); } }); const int popupX = 40; const int popupY = 30; var additionalWindow = new ModalWindow("", path) { HeaderLine = " Дополнительные сведения:" }; const int offset = 120; for (var i = 2; i < 7; i++) { additionalWindow.Cells[1, i].X -= offset; additionalWindow.Cells[0, i].Width -= offset; additionalWindow.Cells[1, i].Width = offset; } additionalWindow.AddChild(new RawButton("", Path.Combine(path, "generic/modals/RawButtons/bt_ok.raw"), Path.Combine(path, "generic/modals/RawButtons/bt_ok_pr.raw"), popupX + 151, popupY) { OnRelease = () => { additionalWindow.IsVisible = false; window.Invalidate(); } }); window.AddPopup(additionalWindow); window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_additional_info.raw"), Path.Combine(path, "RawButtons/bt_additional_info_pr.raw"), 350, 105) { OnRelease = () => { additionalWindow.IsVisible = true; window.Invalidate(); } }); mMeasureController.Window7DataAction = (sample, aoa, oa, executor, date, startTime, endTime, totalTime, stability, Ebase, Esample, Emax, t) => { table.Cells[1, 0].Text = sample; table.Cells[1, 1].Text = aoa; table.Cells[1, 2].Text = oa; table.Cells[1, 3].Text = executor; table.Cells[1, 4].Text = date; additionalWindow.Cells[0, 2].Text = "Затраченное время:"; additionalWindow.Cells[1, 2].Text = totalTime; additionalWindow.Cells[0, 3].Text = "Начальный потенциал:"; if (Ebase.HasValue) { additionalWindow.Cells[1, 3].Text = Ebase.Value.ToString("F2") + " мВ"; } else { additionalWindow.Cells[1, 3].Text = "-"; } additionalWindow.Cells[0, 4].Text = "Потенциал пробы:"; if (Esample.HasValue) { additionalWindow.Cells[1, 4].Text = Esample.Value.ToString("F2") + " мВ"; } else { additionalWindow.Cells[1, 4].Text = "-"; } additionalWindow.Cells[0, 5].Text = "Макс. потенциал:"; if (Emax.HasValue) { additionalWindow.Cells[1, 5].Text = Emax.Value.ToString("F2") + " мВ"; } else { additionalWindow.Cells[1, 5].Text = "-"; } }; return(window); }
private static IWidget CreateWindow6_1(string path) { var window = new Window("window6_1", Path.Combine(path, @"generic/bg.raw")); // {Description = {Text = "Измерение потенциала системы с пробой"}}; window.AddChild(new TextArea("window6_1_title", null, 10, 215, 400) { Color = { B = 1, G = 1, R = 1 }, Text = "Идет измерение потенциала", Size = 16 }); var progressArea = new ProgressBarImages("bar", path, 10, 10) { Percent = 100, Text = "", TextColor = { B = 1, R = 1, G = 1 } }; window.AddChild(progressArea); const int btnsX = 350; const int btnsYBase = 100; const int btnsYStep = 70; window.AddChild(new RawButton("window_6_1_graphic", Path.Combine(path, "RawButtons/bt_graphic.raw"), Path.Combine(path, "RawButtons/bt_graphic_pr.raw"), btnsX, ToVgY(btnsYBase)) { OnRelease = () => mMeasureController.ShowSampleGraphic() }); var table = new TextTable("window6_1.table", 15, 60, new[] { 210, 100 }, TextTable.CreateOffset(5, 22), new[] { 4, 4 }, null, 16); table.Cells[0, 0].Text = "Потенциал"; table.Cells[0, 1].Text = "Тип активности"; table.Cells[0, 2].Text = "Стабильность потенциала"; table.Cells[0, 3].Text = "Времени затрачено"; table.Cells[0, 4].Text = "Времени осталось"; window.AddChild(table); mMeasureController.Window61DataAction = (percent, status, potential, temperature, activity, stability, time, left) => { progressArea.Percent = percent; progressArea.Text = status; table.Cells[1, 0].Text = potential; table.Cells[1, 1].Text = activity; table.Cells[1, 2].Text = stability; table.Cells[1, 3].Text = time; table.Cells[1, 4].Text = left; window.Invalidate(); }; const int popupX = 40; const int popupY = 30; #region acceptPopup var acceptPopup = new ModalWindow("", path); acceptPopup.TextLines[1].Text = " Принять текущее значение потенциала?"; acceptPopup.TextLines[1].Size = 16; acceptPopup.AddChild(new RawButton("", Path.Combine(path, "generic/modals/RawButtons/bt_yes.raw"), Path.Combine(path, "generic/modals/RawButtons/bt_yes_pr.raw"), popupX + 280, popupY) { OnRelease = () => { mMeasureController.StopSampleMeasure(); acceptPopup.IsVisible = false; window.Invalidate(); } }); acceptPopup.AddChild(new RawButton("", Path.Combine(path, "generic/modals/RawButtons/bt_no.raw"), Path.Combine(path, "generic/modals/RawButtons/bt_no_pr.raw"), popupX + 20, popupY) { OnRelease = () => { acceptPopup.IsVisible = false; window.Invalidate(); } }); window.AddPopup(acceptPopup); #endregion window.AddChild(new RawButton("window_6_1_accept", Path.Combine(path, "RawButtons/bt_accept.raw"), Path.Combine(path, "RawButtons/bt_accept_pr.raw"), btnsX, 5) { OnRelease = () => { acceptPopup.IsVisible = true; window.Invalidate(); } }); #region stopPopup var stopPopup = new ModalWindow("", path); stopPopup.TextLines[1].Text = " Вы действительно хотите остановить"; stopPopup.TextLines[1].Size = 16; stopPopup.TextLines[2].Text = " исследование?"; stopPopup.TextLines[2].Size = 16; stopPopup.AddChild(new RawButton("", Path.Combine(path, "generic/modals/RawButtons/bt_yes.raw"), Path.Combine(path, "generic/modals/RawButtons/bt_yes_pr.raw"), popupX + 280, popupY) { OnRelease = () => { mMeasureController.OnStopSampleMeasure(); stopPopup.IsVisible = false; window.Invalidate(); } }); stopPopup.AddChild(new RawButton("", Path.Combine(path, "generic/modals/RawButtons/bt_no.raw"), Path.Combine(path, "generic/modals/RawButtons/bt_no_pr.raw"), popupX + 20, popupY) { OnRelease = () => { stopPopup.IsVisible = false; window.Invalidate(); } }); window.AddPopup(stopPopup); #endregion window.AddChild(new RawButton("window_6_1_stop", Path.Combine(path, "RawButtons/bt_stop.raw"), Path.Combine(path, "RawButtons/bt_stop_pr.raw"), btnsX, ToVgY(btnsYBase + btnsYStep)) { OnRelease = () => { stopPopup.IsVisible = true; window.Invalidate(); } }); window.OnShow = () => { acceptPopup.IsVisible = false; stopPopup.IsVisible = false; }; return(window); }
private static IWidget CreateWindow6_3(string path) { var window = new Window("window6_3", Path.Combine(path, @"generic/bg.raw")); window.AddChild(new RawButton("window6_3_home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247) { OnRelease = () => mApplication.SetFocusedWindow("window1") }); window.AddChild(new TextArea("window6_1_title", null, 10, 215, 400) { Color = { B = 1, G = 1, R = 1 }, Text = "Результат измерения потенциала", Size = 16 }); const int btnsX = 350; const int btnsYBase = 100; const int btnsYStep = 70; window.AddChild(new RawButton("window_6_3_graphic", Path.Combine(path, "RawButtons/bt_graphic.raw"), Path.Combine(path, "RawButtons/bt_graphic_pr.raw"), btnsX, ToVgY(btnsYBase)) { OnRelease = () => mMeasureController.ShowSampleGraphic() }); window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_onwards.raw"), Path.Combine(path, "RawButtons/bt_onwards_pr.raw"), btnsX, 5) { OnRelease = () => mMeasureController.OnEndOfMeasureProcess() }); window.AddChild(new ProgressBarImages("bar", path, 10, 10) { Percent = 100, Text = " Завершено", TextColor = { B = 1, R = 1, G = 1 } }); var table = new TextTable("window6_3.table", 15, 115, new[] { 210, 100 }, TextTable.CreateOffset(3, 22), new[] { 4, 4 }, null, 16); table.Cells[0, 0].Text = "Значение потенциала"; table.Cells[0, 1].Text = "Тип активности"; table.Cells[0, 2].Text = "Стабильность потенциала"; window.AddChild(table); mMeasureController.Window63DataAction = (potential, temperature, activity, stability) => { table.Cells[1, 0].Text = potential; table.Cells[1, 1].Text = activity; table.Cells[1, 2].Text = stability; window.Invalidate(); }; #region Repeat modal window const int popupX = 40; const int popupY = 30; var repeatPopup = new ModalWindow("", path); // "xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxx " repeatPopup.TextLines[1].Text = " Вы действительно хотите"; repeatPopup.TextLines[1].Size = 20; repeatPopup.TextLines[2].Text = " начать измерение заново?"; repeatPopup.TextLines[2].Size = 20; repeatPopup.AddChild(new RawButton("", Path.Combine(path, "generic/modals/RawButtons/bt_yes.raw"), Path.Combine(path, "generic/modals/RawButtons/bt_yes_pr.raw"), popupX + 280, popupY) { OnRelease = () => { repeatPopup.IsVisible = false; mMeasureController.Reset(); mApplication.SetFocusedWindow("window3"); window.Invalidate(); } }); repeatPopup.AddChild(new RawButton("", Path.Combine(path, "generic/modals/RawButtons/bt_no.raw"), Path.Combine(path, "generic/modals/RawButtons/bt_no_pr.raw"), popupX + 20, popupY) { OnRelease = () => { repeatPopup.IsVisible = false; window.Invalidate(); } }); window.AddPopup(repeatPopup); #endregion window.AddChild(new RawButton("", Path.Combine(path, "RawButtons/bt_repeat_measurement.raw"), Path.Combine(path, "RawButtons/bt_repeat_measurement_pr.raw"), btnsX, ToVgY(btnsYBase + btnsYStep)) { OnRelease = () => { repeatPopup.IsVisible = true; window.Invalidate(); } }); #region Popup visibility { // TODO: set all to false //repeatPopup.IsVisible = true; } #endregion return(window); }
// работа с архивом. копирование / удаление private static Window CreateWindow10_1(string path) { var window = new Window("window10_1", Path.Combine(path, @"generic/bg.raw")); window.AddChild(new RawButton("window10_1.home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247) { OnRelease = () => mApplication.SetFocusedWindow("window1") }); var list = new ListWidget("list", 10, 70, new [] { 130, 180 }, TextTable.CreateOffset(6, 26)); window.OnShow = () => { var descs = mDeviceControl.GetSavedReportsDescs().OrderByDescending(d => d.Date); var items = new ListWidget.Item[descs.Count()]; var i = 0; foreach (var desc in descs) { items[i] = new ListWidget.Item { Column1 = desc.SampleName, Column2 = desc.Date.ToString(CultureInfo.GetCultureInfo("ru-RU")), Id = desc.Id }; i++; } list.Items = items; }; window.AddChild(list); window.AddChild(new RawButton("window10_1.btn_up", Path.Combine(path, @"10/1/bt_up.raw"), Path.Combine(path, @"10/1/bt_up_press.raw"), 333, 175) { OnRelease = list.Up }); //window10_1.AddChild(new RawButton("window10_1.btn_mark", Path.Combine(path, @"10/1/bt_mark.raw"), Path.Combine(path, @"10/1/bt_mark_press.raw"), 333, ToVgY(145)) { PixelFormat = pixelFormat }); window.AddChild(new RawButton("window10_1.btn_down", Path.Combine(path, @"10/1/bt_down.raw"), Path.Combine(path, @"10/1/bt_down_press.raw"), 333, 60) { OnRelease = list.Down }); window.AddChild(new RawButton("window10_1.btn_view", Path.Combine(path, @"10/1/bt_view.raw"), Path.Combine(path, @"10/1/bt_view_press.raw"), 5, 5) { OnRelease = () => mMeasureController.ShowReport((Guid)list.CurrentSelection) }); window.AddChild(new RawButton("window10_1.btn_copy", Path.Combine(path, @"10/1/bt_copy.raw"), Path.Combine(path, @"10/1/bt_copy_press.raw"), 125, 5) { OnRelease = () => mMeasureController.CopyReport((Guid)list.CurrentSelection) }); window.AddChild(new RawButton("window10_1.btn_delete", Path.Combine(path, @"10/1/bt_delete.raw"), Path.Combine(path, @"10/1/bt_delete_press.raw"), 245, 5) { OnRelease = () => { var id = list.CurrentSelection; if (id != null) { mDeviceControl.RemoveReports(new [] { (Guid)id }); } window.OnShow(); window.Invalidate(); } }); //window10_1.AddChild(new RawButton("window10_1.btn_filter", Path.Combine(path, @"10/1/bt_filter.raw"), Path.Combine(path, @"10/1/bt_filter_press.raw"), 365, 5) { PixelFormat = pixelFormat }); return(window); }