예제 #1
0
        //protected void AddTitleImage(List<String> imageUris, List<MouseButtonEventHandler> es)
        //{
        //    if (imageUris.Count != es.Count)
        //    {
        //        return;
        //    }
        //    StackPanel sp = GetTitle();
        //    StackPanel spBottomImage = new StackPanel();
        //    spBottomImage.Margin = new Thickness(0, 0, 35, 10);
        //    spBottomImage.HorizontalAlignment = HorizontalAlignment.Right;

        //    spBottomImage.Orientation = Orientation.Horizontal;
        //    for (int i = imageUris.Count - 1; i >= 0; i--)
        //    {
        //        Image iv = new Image
        //        {
        //            Width = 20,
        //            Height = 20,
        //            Source = new BitmapImage(new Uri("pack://application:,,,/View/Resources/Image/" + imageUris[i], UriKind.RelativeOrAbsolute)),
        //            Stretch = Stretch.Fill
        //        };
        //        if (i == imageUris.Count - 1)
        //        {
        //            iv.Margin = new Thickness(0, 0, 10, 0);
        //        }
        //        else
        //        {
        //            iv.Margin = new Thickness(0, 0, 10, 0);
        //        }
        //        RenderOptions.SetBitmapScalingMode(iv, BitmapScalingMode.Fant);
        //        spBottomImage.Children.Insert(0, iv);
        //        iv.MouseLeftButtonDown += es[i];
        //    }
        //    sp.Children.Add(spBottomImage);
        //}

        //protected Image GetImage(String imageUris,int size, MouseButtonEventHandler e)
        //{
        //    Image image = new Image
        //    {
        //        Width = size,
        //        Height = size,
        //        Source = new BitmapImage(new Uri("pack://application:,,,/View/Resources/Image/" + imageUris, UriKind.RelativeOrAbsolute)),
        //        Stretch = Stretch.Fill
        //    };
        //    image.MouseLeftButtonDown += e;
        //    return image;

        //}


        //protected Image GetImage(String imageUris, int size)
        //{
        //    return new Image
        //    {
        //        Width = size,
        //        Height = size,
        //        Source = new BitmapImage(new Uri("pack://application:,,,/View/Resources/Image/" + imageUris, UriKind.RelativeOrAbsolute)),
        //        Stretch = Stretch.Fill
        //    };
        //}

        private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            int position = (Parent as StackPanel).Children.IndexOf(this);

            if (position == 0)
            {
                return;
            }


            BaseStyle bd  = sw.spMain.Children[position - 1] as BaseStyle;
            BaseStyle bd2 = sw.spMain.Children[position] as BaseStyle;

            sw.spMain.Children.RemoveAt(position - 1);
            sw.spMain.Children.RemoveAt(position - 1);
            sw.spMain.Children.Insert(position - 1, bd2);
            sw.spMain.Children.Insert(position, bd);

            BaseOperationModel bom  = sw.operationModels[position - 1] as BaseOperationModel;
            BaseOperationModel bom2 = sw.operationModels[position] as BaseOperationModel;

            sw.operationModels.RemoveAt(position - 1);
            sw.operationModels.RemoveAt(position - 1);
            sw.operationModels.Insert(position - 1, bom2);
            sw.operationModels.Insert(position, bom);

            sw.OnRefresh();
        }
예제 #2
0
        private void Image2_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            int position = (Parent as StackPanel).Children.IndexOf(this);

            BaseStyle bd  = sw.spMain.Children[position] as BaseStyle;
            BaseStyle bd2 = sw.spMain.Children[position + 1] as BaseStyle;

            sw.spMain.Children.RemoveAt(position);
            sw.spMain.Children.RemoveAt(position);
            sw.spMain.Children.Insert(position, bd2);
            sw.spMain.Children.Insert(position + 1, bd);

            BaseOperationModel bom  = sw.operationModels[position] as BaseOperationModel;
            BaseOperationModel bom2 = sw.operationModels[position + 1] as BaseOperationModel;

            sw.operationModels.RemoveAt(position);
            sw.operationModels.RemoveAt(position);
            sw.operationModels.Insert(position, bom2);
            sw.operationModels.Insert(position + 1, bom);

            sw.OnRefresh();
        }