public void OpenWindow(UserControl control, WindowViewModelBase_VM dataContext, double width, double height, double minwidth, double minheight, Window ownerWindow)
        {
            var newWindow = RegistredWindow(control, dataContext, width, height, minwidth, minheight, null, null);

            newWindow.Owner = ownerWindow;
            newWindow.Show();
        }
        public object OpenWindowDialog(
            UserControl control,
            WindowViewModelBase_VM dataContext,
            double width,
            double height,
            double minwidth,
            double minheight,
            WindowViewModelBase_VM ownerMV = null)
        {
            object value          = null;
            Action <object> close = delegate(object obj) { value = obj; };
            var newWindow         = RegistredWindow(control, dataContext, width, height, minwidth, minheight, close, ownerMV);

            newWindow.ShowDialog();
            return(value);
        }
        private Window RegistredWindow(UserControl control, WindowViewModelBase_VM dataContext, double width, double height, double minwidth, double minheight, Action <object> close = null, WindowViewModelBase_VM ownerMV = null)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }
            if (dataContext == null)
            {
                throw new ArgumentNullException("dataContext");
            }
            Window newWindow;

            if (_hasVMWindow.ContainsKey(dataContext))
            {
                newWindow = _hasVMWindow[dataContext];
                newWindow.Activate();
            }
            else
            {
                Action <object> closeAct = delegate(object obj)
                {
                    _hasVMWindow.Remove(dataContext);
                    if (close != null)
                    {
                        close(obj);
                    }
                };
                var ownerWindow = (ownerMV != null && _hasVMWindow.ContainsKey(ownerMV))
                                    ? _hasVMWindow[ownerMV]
                                    : Program.WinMain;
                newWindow = WindowViewModelBase_VM.GetWindow(control, dataContext, width, height, minwidth, minheight, ownerWindow, closeAct);
                if (dataContext != null)
                {
                    newWindow.Title = dataContext.Title;
                }
                _hasVMWindow.Add(dataContext, newWindow);
            }
            return(newWindow);
        }
        /// <summary>
        /// Открыть окно атрибутов объекта
        /// </summary>
        /// <param name="table">Слой</param>
        /// <param name="id"></param>
        /// <param name="wkt"></param>
        /// <param name="ownerMV"></param>
        public override void OpenObject(AbsM.ITableBaseM table, object idObject, string wkt = null, WindowViewModelBase_VM ownerMV = null)
        {
            if (idObject != null && !(idObject is int))
            {
                throw new Exception("Неверный параметр");
            }

            var cosmTable       = table as CosM.CosmeticTableBaseM;
            var cosmAttributeVM = new CosmeticAttributes.CosmeticAttributesVM(table, (int?)idObject, false, wkt);

            cosmAttributeVM.Reload();

            OpenWindow(
                new View.CosmeticAttributes.CosmeticAttributesV(),
                cosmAttributeVM,
                750, 550,
                400, 300,
                ownerMV);
        }
        public override object OpenTable(AbsM.ITableBaseM table, object id = null, bool isSelected = false, WindowViewModelBase_VM ownerMV = null)
        {
            //(new layerInfo(_mv, table.Name)).Show();
            //return null;

            if (table != null)
            {
                var tableViewVM = new CosmeticTableViewVM(table as CosM.CosmeticTableBaseM);
                var tableViewV  = new CosV.CosmeticTableViewV();
                if (isSelected)
                {
                    return(OpenWindowDialog(
                               tableViewV,
                               tableViewVM,
                               767, 570,
                               500, 300,
                               ownerMV
                               ));
                }
                else
                {
                    OpenWindow(
                        tableViewV,
                        tableViewVM,
                        767, 570,
                        500, 300,
                        ownerMV
                        );
                }
            }
            return(null);
        }
Example #6
0
 public override object OpenTable(AbsM.ITableBaseM table, object id = null, bool isSelected = false, WindowViewModelBase_VM ownerMV = null)
 {
     (new layerInfo(_mv, table.Name)).Show();
     return(null);
 }
 public virtual void OpenObject(AbsM.ITableBaseM table, object id, String wkt = null, WindowViewModelBase_VM ownerMV = null)
 {
     return;
 }
 public virtual object OpenTable(AbsM.ITableBaseM table, object id = null, bool isSelected = false, WindowViewModelBase_VM ownerMV = null)
 {
     return(null);
 }