private void Ellipse_OnMouseDown(object sender, MouseButtonEventArgs e) { var ellipse = (sender as Viewbox); if (ellipse == null) { return; } var ellipseName = ellipse.Name; Viewbox active_viewbox = null; switch (ellipseName) { case "nad_blin": active_viewbox = nad_blin; ResultState = GateWayThrowEnum.nad_blin; break; case "nad_trap": active_viewbox = nad_trap; ResultState = GateWayThrowEnum.nad_trap; break; case "v_telo": active_viewbox = v_telo; ResultState = GateWayThrowEnum.v_telo; break; case "pod_blin": active_viewbox = pod_blin; ResultState = GateWayThrowEnum.pod_blin; break; case "pod_trap": active_viewbox = pod_trap; ResultState = GateWayThrowEnum.pod_trap; break; case "v_dom": active_viewbox = v_dom; ResultState = GateWayThrowEnum.v_dom; break; default: break; } var view_grid = (active_viewbox.Child as Grid); var actives = view_grid.Children.OfType <Ellipse>(); var active_ellipse = actives.FirstOrDefault(); if (active_ellipse != null) { this.SetEllipsesActivities(active_ellipse); } }
// TODO: Отобазить результат public void ForseSetValue(GateWayThrowEnum value) { ResultState = value; Ellipse selected_ellipse = null; switch (value) { case GateWayThrowEnum.none: break; case GateWayThrowEnum.nad_blin: selected_ellipse = nad_blin_ellipse; break; case GateWayThrowEnum.nad_trap: selected_ellipse = nad_trap_ellipse; break; case GateWayThrowEnum.v_telo: selected_ellipse = v_telo_ellipse; break; case GateWayThrowEnum.pod_blin: selected_ellipse = pod_blin_ellipse; break; case GateWayThrowEnum.pod_trap: selected_ellipse = pod_trap_ellipse; break; case GateWayThrowEnum.v_dom: selected_ellipse = v_dom_ellipse; break; default: throw new ArgumentOutOfRangeException(nameof(value), value, null); } SetEllipsesActivities(selected_ellipse); }
public void ResetDisplay() { ResultState = GateWayThrowEnum.none; SetEllipsesActivities(null); }