Exemplo n.º 1
0
 public void CloseFunction(ApplicationFunction function)
 {
     UserControlFunctionItem<ApplicationFunction> first =
     openedUserControlCollection.FirstOrDefault(f => f.Data.ID == function.ID);
       if (first != null)
       {
     //test if exist when the collection removed
     var dispose = first.Content as IDisposable;
     if (dispose != null)
       dispose.Dispose();
     openedUserControlCollection.Remove(first);
       }
 }
Exemplo n.º 2
0
        public virtual void FunctionClick(ApplicationFunction function)
        {
            UserControlFunctionItem<ApplicationFunction> first =
            openedUserControlCollection.FirstOrDefault(f => f.Data.ID == function.ID);
              if (first != null)
              {
            CurrentUserControl = first;
            return;
              }
              var control = new UserControlFunctionItem<ApplicationFunction>(function.ImageUrl, CloseFunction)
              {
            Header = function.Name,
            Data = function,
            Content = GetContentFromFunction(function),
              };

              var showProgress = control.Content.DataContext as IProgress;
              if (showProgress != null)
              {
            showProgress.StartShowing = s => control.Progress.ShowProgress(string.Format("Loading {0}", function.Name));
            showProgress.StopShowing = () => control.Progress.HideProgress();
              }

              var dataLoad = control.Content as IDataLoad;
              if (dataLoad != null)
              {
            dataLoad.Load();
              }

              openedUserControlCollection.Add(control);
              CurrentUserControl = control;
              NotifyOfPropertyChange(() => OpenedUserControlCollection);
        }
Exemplo n.º 3
0
 public abstract FrameworkElement GetContentFromFunction(ApplicationFunction function);